I have a module whose name ends with Data.List
.
Inside it i want to import module Data.List
from the base library.
module Foo.Data.List
import Data.List
If i invoke idris from folder Foo
then compiler complains:
[Foo]$ idris --check Data/List.idr
Cycle detected in imports: Data/List.idr -> Data/List -> Data/List
I guess because it prefers the module being in the current source folder, that is the module just being defined.
How can i refer to the one Data.List
which is in the base library?
My little source file in its full:
module Foo.Data.List
import Data.List as S
last : List e -> Maybe e
last l = case l of
(h::t) => Just (S.last (h::t))
_ => Nothing
Updated:
If i invoke idris from the folder containing Foo
,
idris --check Foo/Data.List.idr
then I get the error message:
When checking right hand side of Foo.Data.List.case block in last at ./Foo/Data/List.idr:6:15 with expected type
Maybe e
When checking argument x to constructor Prelude.Maybe.Just:
Type mismatch between
Maybe e (Type of last (h :: t))
and
e (Expected type)
Which implies that the compiler considers S.last
as Foo.Data.List.last
instead of base.Data.List.last
.