0
當我嘗試加載我的海斯特(0.11)模板使用此功能:爲什麼我會收到EitherT類型的錯誤?
load :: MonadIO n => FilePath -> [(Text, Splice n)] -> IO (HeistState n)
load baseDir splices = do
tmap <- runEitherT $ do
templates <- loadTemplates baseDir
let hc = HeistConfig [] defaultLoadTimeSplices splices [] templates
initHeist hc
either (error . concat) return tmap
我得到這個錯誤:
Couldn't match expected type `EitherT e0 m0 t0'
with actual type `either-3.1:Control.Monad.Trans.Either.EitherT
[String] IO Heist.TemplateRepo'
In the return type of a call of `loadTemplates'
In a stmt of a 'do' block: templates <- loadTemplates baseDir
In the second argument of `($)', namely
`do { templates <- loadTemplates baseDir;
let hc
= HeistConfig [] defaultLoadTimeSplices splices [] templates;
initHeist hc }'
對我來說,loadTemplate
似乎返回預期的類型,除了與類型參數填入混凝土類型。我錯過了什麼?
這看起來像是一個破損的軟件包設置 - 注意它是如何引用特定軟件包版本的類型?這是一個強有力的指標,表明您有依賴關係問題。 – 2013-02-09 20:41:21
用於'load'的導入和用於'loadTemplates'的導入從不同模塊或版本或包中的不同定義獲得'EitherT'。 – 2013-02-10 11:56:37
在安裝了相同軟件包的多個版本的情況下會發生這種情況。使用ghc-pkg刪除任一軟件包的所有版本,然後重新安裝並再次嘗試。 – mightybyte 2013-02-11 16:38:16