Open yellowsquid opened 2 months ago
I'm not sure this is a bug, although it is a non-intuitive/bad design of the module system/namespace management. We do know we want a better one, but currently we do not have resources to allocate to design it. @jacobjwalters has given it some thought in his UG dissertation, but it's somewhat hard.
Workarounds:
import Data.Vect
in client modules (Bar
in this example).import public Data.Vect
in exporing module (Foo
in this example).I'm going to tag this as expected behaviour, but happy to be overruled following a decent a discussion.
Another option would be to propose a mechanism for detecting this and issuing a warning. Note that issued warning ought to have a corresponding mechanism for suppressing it when the warned-against situation is desired by the user.
Maybe an easier way to deal with this would be to communicate where the term is stuck:
Bar> :reload
2/2: Building Bar (Bar.idr)
Error: While processing right hand side of ItIsOne. Can't solve constraint
between: S (assert_total (integerToNat 0))
and: plus (head Nat 0 ((::) 0 Nat 1 ([] Nat))) 0.
^^^^
└ Stuck here
Bar:6:11--6:15
2 |
3 | import Foo
4 |
5 | ItIsOne : ThisIsOne = 1
6 | ItIsOne = Refl
^^^^
Error(s) building file Bar.idr
Steps to Reproduce
We have two files,
Foo.idr
andBar.idr
:Foo.idr
:Bar.idr
:We then have the following session in the repl:
Observed Behaviour
We then fill the hole
?a
withRefl
.Expected Behavior
Idris to either: 1) accept
Refl
as valid 2) identify thatData.Vect.head
is not imported.To justify 2, consider this varaint of
Foo.idr
:When we go back to the repl (with
Refl
still in place), we get the more useful error:Environment