安装 Quipper 时出错 - 无法构建 quipper-utils-0.9.0.0(无法将类型 'Maybe TH.Exp' 与"TH"匹配。经验')



试图安装Quipper(Haskell的量子编程语言(时,会抛出编译错误:

我的构建配置文件:-w ghc-9.0.1-O1

Preprocessing library for quipper-utils-0.9.0.0..
Building library for quipper-utils-0.9.0.0..
...
[11 of 15] Compiling Quipper.Utils.Template.Lifting ( Quipper/Utils/Template/Lifting.hs, dist/build/Quipper/Utils/Template/Lifting.o, dist/build/Quipper/Utils/Template/Lifting.dyn_o )
Quipper/Utils/Template/Lifting.hs:252:28: error:
• Couldn't match type ‘Maybe TH.Exp’ with ‘TH.Exp’
Expected: [TH.Exp]
Actual: [Maybe TH.Exp]
• In the second argument of ‘mapM’, namely ‘exps’
In a stmt of a 'do' block: exps' <- mapM expTHtoAST exps
In the expression:
do exps' <- mapM expTHtoAST exps
return (TupE exps')
|
252 |   exps' <- mapM expTHtoAST exps
|                            ^^^^
Quipper/Utils/Template/Lifting.hs:417:20: error:
• Couldn't match type ‘TH.Exp’ with ‘Maybe TH.Exp’
Expected: [Maybe TH.Exp]
Actual: [TH.Exp]
• In the first argument of ‘TH.TupE’, namely ‘exps'’
In the second argument of ‘($)’, namely ‘TH.TupE exps'’
In a stmt of a 'do' block: return $ TH.TupE exps'
|
417 |   return $ TH.TupE exps'
|                    ^^^^^
cabal: Failed to build quipper-utils-0.9.0.0 (which is required by
quipper-0.9.0.0). See the build log above for details.

我敢肯定Quipper包的边界太宽松了。GHC9.0.1中的模板Haskell有一些变化。template-haskell库的版本绑定到您正在使用的GHC版本,因此您必须使用GHC的旧版本。我已经用GHC 8.8.4测试了它,它有效。

尝试从这里安装8.6.5版本:https://www.haskell.org/platform/prior.html.我也遇到了同样的问题,这对我很有效。

最新更新