Error: "Failed to load interface for 'Data.Either.Utils'"

Error: "Failed to load interface for 'Data.Either.Utils'"

有谁知道为什么这个单一的特定导入语句会导致问题?我正在使用沙箱和阴谋集团。我的其他导入工作正常(Web.Scotty、Data.Text.Lazy 等)。我 运行 "cabal exec runghc filename.hs"。我没有 cabal.config 文件,但我有 cabal.sandbox.config 文件。

我正在尝试使用 Data.Either.Utils 中的 forceEither 函数。据我所知,我的导入语句是正常的:

{-# 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

Data.Either.Utils 模块不是 "base" Haskell 的一部分;它是 MissingH 包的一部分,那个包好像是..哈哈..不见了!

我不太熟悉 Cabal 沙箱(我使用 Stack),但大概你可以 运行:

cabal install MissingH

在你的沙盒中,你应该可以开始了。

如果这不起作用,只需从 MissingH 复制 forceEither 的代码:

forceEither :: Show e => Either e a -> a
forceEither (Left x) = error (show x)
forceEither (Right x) = x