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

∥☆過路亽.° 提交于 2019-12-11 02:04:44

问题


Does anyone know why this single, specific import statement is causing a problem? I'm using sandbox and cabal. My other imports work fine (Web.Scotty, Data.Text.Lazy, etc.). I'm running with "cabal exec runghc filename.hs". I don't have a cabal.config file, but I do have a cabal.sandbox.config file.

I'm attempting to use the forceEither function, which is in Data.Either.Utils. My import statements are normal as far as I can tell:

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

Message:

filename.hs:8:1: error:
    Failed to load interface for ‘Data.Either.Utils’
    Use -v to see a list of the files searched for.

Running with -v shows:

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

回答1:


The Data.Either.Utils module is not part of "base" Haskell; it's part of the MissingH package, and that package seems to be .. ha ha .. missing!

I'm not too familiar with Cabal sandboxes (I use Stack), but presumably you can run:

cabal install MissingH

in your sandbox, and you should be good to go.

If that doesn't work, just copy the code for forceEither from MissingH:

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


来源:https://stackoverflow.com/questions/40998196/error-failed-to-load-interface-for-data-either-utils

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!