GHCi无法解析同一包的两个版本中的名称

时间:2015-04-27 05:04:09

标签: haskell ghci parsec

我正在尝试使用Parsec的OperatorTable以下内容:

table :: Ex.OperatorTable String () Identity Expr
table = [[]]

cabal buildcabal run有效,但将Main加载到GHCi中会给我一个奇怪的错误:

Parser.hs:127:33:
    Couldn't match type ‘Identity’
                  with ‘transformers-0.3.0.0:Data.Functor.Identity.Identity’
    NB: ‘Identity’
          is defined in ‘Data.Functor.Identity’
              in package ‘transformers-0.4.3.0’
        ‘transformers-0.3.0.0:Data.Functor.Identity.Identity’
          is defined in ‘Data.Functor.Identity’
              in package ‘transformers-0.3.0.0’
    Expected type: Ex.OperatorTable
                     String () transformers-0.3.0.0:Data.Functor.Identity.Identity Expr
      Actual type: Ex.OperatorTable String () Identity Expr
    In the first argument of ‘Ex.buildExpressionParser’, namely ‘table’
    In the expression: Ex.buildExpressionParser table factor

因此,我删除了~/.cabal.cabal-sandbox并重新安装了mtl,全局和新沙箱中都出现了错误。

ghc-pkg list | grep trans给出:

transformers-0.3.0.0
transformers-0.4.3.0

所以我尝试了ghc-pkg unregister transformers-0.3.0.0,但是看到了一堆关于其他软件包如何破坏的警告信息:

ghc-pkg: unregistering transformers-0.3.0.0 would break the following
packages: regex-posix-0.95.2 regex-compat-0.95.1 regex-base-0.93.2
parsec-3.1.5 network-2.4.2.3 mtl-2.1.3.1 fgl-5.5.0.1 HTTP-4000.2.10
ghc-7.8.3 haskeline-0.7.1.2 (use --force to override)

没有继续。

还尝试了ghci -package transformers-0.4.3.0并遇到了同样的错误。

我现在该怎么办? :\

我的.cabal文件包含transformers <= 0.4.3.0。我在OS X 10.10.2上使用GHC 7.8.3。

0 个答案:

没有答案