我有一個模塊,其名稱以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