我有一个模块,其名称以Data.List
结尾。 在里面我想从基础库导入模块Data.List
。Idris模块名称与'base'冲突
module Foo.Data.List
import Data.List
如果我调用从文件夹Foo
伊德里斯那么编译器抱怨:
[Foo]$ idris --check Data/List.idr
Cycle detected in imports: Data/List.idr -> Data/List -> Data/List
我猜是因为它喜欢的模块中的电流源文件夹是,这仅仅是被定义的模块。
我该如何参考基础库中的Data.List
?在其全
我的小源文件:
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
更新时间:
如果我从包含Foo
的文件夹调用伊德里斯,
idris --check Foo/Data.List.idr
然后我得到的错误信息:
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)
这意味着编译器将S.last
视为Foo.Data.List.last
而不是base.Data.List.last
。
我使用0.10.0上惊天动地的释放。 – libeako