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

时间:2015-10-01 21:03:57

标签: haskell vector repa

我已使用Cabal for GHC 7.10.2安装了Vector软件包和REPA。运行这个程序:

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)

我收到以下错误:

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)’

运行ghc-pkg list | grep vector,我注意到了两个版本的矢量包:

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

我运行ghc-pkg hide vector-0.10.12.3并尝试重新编译,但错误仍然存​​在。似乎已经安装了vector-0.10.12.3(它是Base的一部分吗?)但它没有公开Data.Vector.Unboxed。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

我认为您需要隐藏其他版本。 GHCi似乎正在引入最新的版本REPA,其中不是编译的stackcabal以善于避免这类问题而闻名,但在特别简单的情况下,即使for (index,user) in myUsersArray.enumerate() { guard user.id != nil else { print("no userId") //neither break / return will keep running the for loop } if user.id == myUser.id { //do stuff } } 也应该能够弄明白。您可能希望为项目设置Cabal或Stack配置。