错误:“无法加载'Data.Either.Utils'的接口” [英] Error: "Failed to load interface for 'Data.Either.Utils'"

查看:67
本文介绍了错误:“无法加载'Data.Either.Utils'的接口”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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)

消息:

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 模块不属于基础 Haskell;它是MissingH软件包的一部分,而该软件包似乎是..哈哈..丢失!

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!

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

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.

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

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

这篇关于错误:“无法加载'Data.Either.Utils'的接口”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆