有人知道为什么这个单一的、特定的导入语句会导致问题吗?我用的是沙箱和阴谋。我的其他导入可以正常工作(Web.Scotty、Data.Text.Lazy等)。我正在和“阴谋执行委员会的filename.hs”一起跑。我没有cabal.config文件,但我有一个cabal.sandbox.config文件。
我正在尝试使用forceEither函数,它在Data.Either.Utils中。据我所知,我的导入语句是正常的:
{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import Control.Monad.Trans (liftIO)
import Data.Aeson (object, (.=))
import Network.HTTP.Types.Status
import Data.Text.Lazy
import Data.Text.Lazy.IO
import Data.Either.Utils
import Data.Monoid (mconcat)消息:
filename.hs:8:1: error:
Failed to load interface for ‘Data.Either.Utils’
Use -v to see a list of the files searched for.使用-v运行显示:
Using a sandbox located at
/Users/myuser/Desktop/mydirectory/myotherdirectory/.cabal-sandbox
/usr/local/bin/ghc --print-global-package-db
/usr/local/bin/runghc filename.hs发布于 2016-12-07 01:19:39
Data.Either.Utils模块不是"base“的一部分;它是MissingH包的一部分,而该包似乎是..。哈哈..。失踪了!
我不太熟悉Cabal沙箱(我使用Stack),但是您可以运行:
cabal install MissingH在你的沙箱里,你应该走得很好。
如果这样做不起作用,只需从MissingH复制forceEither的代码:
forceEither :: Show e => Either e a -> a
forceEither (Left x) = error (show x)
forceEither (Right x) = xhttps://stackoverflow.com/questions/40998196
复制相似问题