1

I've installed the Vector package and REPA using Cabal for GHC 7.10.2. 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, I noticed 2 versions of the vector package:

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. It seems that vector-0.10.12.3 already came installed (is it part of Base?) but it didn't expose Data.Vector.Unboxed. How can I solve this issue?

MaiaVictor
  • 51,090
  • 44
  • 144
  • 286

1 Answers1

1

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. 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. You may want to set up a Cabal or Stack configuration for your project.

dfeuer
  • 48,079
  • 5
  • 63
  • 167