Idris-dev icon indicating copy to clipboard operation
Idris-dev copied to clipboard

Importing nonexistent modules breaks other imports

Open trillioneyes opened this issue 12 years ago • 2 comments

Importing Prelude.Decidable.Equality brings names defined in the module Decidable.Equality into scope, but prevents names defined in Data.Vect from coming into scope:

-- Silly.idr
module Silly
import Data.Vect
import Prelude.Decidable.Equality

hands : Elem 5 [5] -> Bool
hands _ = True
     ____    __     _                                          
    /  _/___/ /____(_)____                                     
    / // __  / ___/ / ___/     Version 0.9.10.1
  _/ // /_/ / /  / (__  )      http://www.idris-lang.org/      
 /___/\__,_/_/  /_/____/       Type :? for help                

Type checking .\Silly.idr
Silly.idr:5:7:When elaborating type of Silly.hands:
No such variable Elem
*Silly> 

If Prelude.Decidable.Equality is changed to Decidable.Equality, the import of Data.Vect succeeds:

-- SillyFixed.idr
module SillyFixed
import Data.Vect
import Decidable.Equality

hands : Elem 5 [5] -> Bool
hands _ = True
     ____    __     _                                          
    /  _/___/ /____(_)____                                     
    / // __  / ___/ / ___/     Version 0.9.10.1
  _/ // /_/ / /  / (__  )      http://www.idris-lang.org/      
 /___/\__,_/_/  /_/____/       Type :? for help                

Type checking .\SillyFixed.idr
*SillyFixed> 

(Edited title in light of new testing: the problem isn't "Prelude.Decidable.Equality" in particular, but nonexistent modules in general.)

trillioneyes avatar Dec 29 '13 08:12 trillioneyes

Now that I look at the module more closely, it seems that import Prelude.Decidable.Equality probably should not successfully bring anything into scope, because the module name as declared in the file is just Decidable.Equality.

I've also done some more testing and determined that importing any nonexistent module prevents other modules from being imported, so it seems that import Prelude.Decidable.Equality is failing in some way even though it successfully brings the DecEq class into scope.

trillioneyes avatar Dec 29 '13 09:12 trillioneyes

This is the same as #494 (I think). I'll have a quick look now...

edwinb avatar Dec 29 '13 13:12 edwinb