我正在尝试使用Parsec的OperatorTable
以下内容:
table :: Ex.OperatorTable String () Identity Expr
table = [[]]
cabal build
和cabal 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。