简体   繁体   English

GHC 7.10.2 Data.Vector.Unboxed与REPA 3.4.0.1冲突

[英]GHC 7.10.2 Data.Vector.Unboxed conflict with REPA 3.4.0.1

I've installed the Vector package and REPA using Cabal for GHC 7.10.2. 我已经使用Cabal for GHC 7.10.2安装了Vector软件包和REPA Running this program: 运行该程序:

import qualified Data.Array.Repa as R
import qualified Data.Vector.Unboxed as U

main = print $ R.fromUnboxed (R.Z R.:. 16 R.:. 16) (U.replicate 10 0)

I get the following error: 我收到以下错误:

repa.hs:4:53:
    Couldn't match expected type ‘vector-0.10.12.3:Data.Vector.Unboxed.Base.Vector
                                    e0’
                with actual type ‘U.Vector a0’
    NB: ‘vector-0.10.12.3:Data.Vector.Unboxed.Base.Vector’
          is defined in ‘Data.Vector.Unboxed.Base’
              in package ‘vector-0.10.12.3’
        ‘U.Vector’
          is defined in ‘Data.Vector.Unboxed.Base’
              in package ‘vector-0.11.0.0’
    In the second argument of ‘R.fromUnboxed’, namely
      ‘(U.replicate 10 0)’
    In the second argument of ‘($)’, namely
      ‘R.fromUnboxed (R.Z R.:. 16 R.:. 16) (U.replicate 10 0)’

Running ghc-pkg list | grep vector 运行ghc-pkg list | grep vector ghc-pkg list | grep vector , I noticed 2 versions of the vector package: ghc-pkg list | grep vector ,我注意到vector包有2个版本:

vector-0.10.12.3
vector-0.11.0.0
vector-th-unbox-0.2.1.2

I ran ghc-pkg hide vector-0.10.12.3 and tried recompiling, but the error persists. 我运行ghc-pkg hide vector-0.10.12.3并尝试重新编译,但是错误仍然存​​在。 It seems that vector-0.10.12.3 already came installed (is it part of Base?) but it didn't expose Data.Vector.Unboxed . 似乎已经安装了vector-0.10.12.3 (它是Base的一部分吗?),但没有公开Data.Vector.Unboxed How can I solve this issue? 我该如何解决这个问题?

I think you need to hide the other version. 我认为您需要隐藏其他版本。 GHCi seems to be pulling in the most recent available version of vector , which is not the one REPA was compiled against. GHCi似乎正在引入vector 最新版本,而这不是 REPA所针对的版本。 stack has a reputation for being good at avoiding these sorts of problems, but in your particularly simple case even cabal should be able to figure it out. stack善于避免此类问题而闻名,但在您特别简单的情况下,即使cabal也应能解决。 You may want to set up a Cabal or Stack configuration for your project. 您可能要为项目设置Cabal或Stack配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM