Creating Repa arrays from unboxed vectors

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating Repa arrays from unboxed vectors

Janek S.
Dear list,

I'm trying to create unboxed REPA array from unboxed Vector, but I keep getting this type error:

ghci> :m + Data.Array.Repa
ghci> :m + Data.Array.Repa.Repr.Unboxed
ghci> :m + Data.Vector.Unboxed
ghci> fromUnboxed Z (Data.Vector.Unboxed.singleton 1)

<interactive>:5:16:
    Couldn't match expected type `vector-0.9.1:Data.Vector.Unboxed.Base.Vector
                                    e0'
                with actual type `Data.Vector.Unboxed.Vector a0'
    In the return type of a call of `Data.Vector.Unboxed.singleton'
    In the second argument of `fromUnboxed', namely
      `(Data.Vector.Unboxed.singleton 1)'
    In the expression: fromUnboxed Z (Data.Vector.Unboxed.singleton 1)

I am confused, because REPA documentation lists Vector from Data.Vector.Unboxed package as its
second parameter. Why am I getting this error? I have Repa 3.2 an vector 0.9.1.

Janek

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Creating Repa arrays from unboxed vectors

Ivan Lazar Miljenovic
On 4 October 2012 20:50, Janek S. <[hidden email]> wrote:

> Dear list,
>
> I'm trying to create unboxed REPA array from unboxed Vector, but I keep getting this type error:
>
> ghci> :m + Data.Array.Repa
> ghci> :m + Data.Array.Repa.Repr.Unboxed
> ghci> :m + Data.Vector.Unboxed
> ghci> fromUnboxed Z (Data.Vector.Unboxed.singleton 1)
>
> <interactive>:5:16:
>     Couldn't match expected type `vector-0.9.1:Data.Vector.Unboxed.Base.Vector
>                                     e0'
>                 with actual type `Data.Vector.Unboxed.Vector a0'
>     In the return type of a call of `Data.Vector.Unboxed.singleton'
>     In the second argument of `fromUnboxed', namely
>       `(Data.Vector.Unboxed.singleton 1)'
>     In the expression: fromUnboxed Z (Data.Vector.Unboxed.singleton 1)

This makes it look like you've got two versions of vector installed,
with Repa built against the version that _isn't_ 0.9.1.

>
> I am confused, because REPA documentation lists Vector from Data.Vector.Unboxed package as its
> second parameter. Why am I getting this error? I have Repa 3.2 an vector 0.9.1.
>
> Janek
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe



--
Ivan Lazar Miljenovic
[hidden email]
http://IvanMiljenovic.wordpress.com

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Creating Repa arrays from unboxed vectors

Janek S.
In reply to this post by Janek S.
Thanks!

> This makes it look like you've got two versions of vector installed,
This is true, I have vector-0.9.1 and vector-0.10, but
> with Repa built against the version that _isn't_ 0.9.1.
this, I think, is not exactly correct:

[root@GLaDOS : /dane/download] ghc-pkg field repa depends
depends: QuickCheck-2.4.2-41cb2884cc20cd78948de62849bd9667
         base-4.5.0.0-6db966b4cf8c1a91188e66d354ba065e
         bytestring-0.9.2.1-18f26186028d7c0e92e78edc9071d376
         ghc-prim-0.2.0.0-c2ff696e5b8ec4d4b2bc2e42085fe471
         template-haskell-2.7.0.0-133c0fdb189e05de22bd926d39f99fe3
         vector-0.9.1-04dd5c58c224b03a4dc90091cf93a01d

So Repa is build againts 0.9.1. Everything works when I do "ghc-pkg hide vector-0.10.0". Is there
a way to tell GHCi which version of library it should load? I tried -XPackageImports but it
doesn't allow to specify version of a package, only its name (or I don't know how to specify
version).

Jan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Creating Repa arrays from unboxed vectors

Chaddaï Fouché
On Thu, Oct 4, 2012 at 1:58 PM, Janek S. <[hidden email]> wrote:
> Thanks!
>
>> This makes it look like you've got two versions of vector installed,
> This is true, I have vector-0.9.1 and vector-0.10, but
>> with Repa built against the version that _isn't_ 0.9.1.

No, no, Repa is build against 0.9.1 since vector-0.9.1 appears in the
_expected_ type, that is the type expected by the environment of the
expression, here that's fromUnboxed which comes from the Repa library,
so if it's waiting for a Vector from vector-0.9.1 it means Repa is
built against this version (which is not the latest on your computer
thus the problem).

--
Jedaï

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Creating Repa arrays from unboxed vectors

Janek S.
> so if it's waiting for a Vector from vector-0.9.1 it means Repa is
> built against this version (which is not the latest on your computer
> thus the problem).
Yes, as I said the latest one is 0.10. Is there any way to sensibly manage this kind of
dependencies (sensibly = without hidding packages manually).

Jan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Creating Repa arrays from unboxed vectors

Michael Sloan

Hello!

Perhaps package imports would do the trick?

http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#package-imports

Not exactly something you'd want to release in a module in a hackage package, though.

-Michael

On Oct 4, 2012 7:07 AM, "Janek S." <[hidden email]> wrote:
> so if it's waiting for a Vector from vector-0.9.1 it means Repa is
> built against this version (which is not the latest on your computer
> thus the problem).
Yes, as I said the latest one is 0.10. Is there any way to sensibly manage this kind of
dependencies (sensibly = without hidding packages manually).

Jan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe