This may be a pretty basic question, but I've searched around and I cannot seem to find the answer.
I would like to represent a 2D list using unboxed Vectors. This is easily done with normal vectors:
> import qualified Data.Vector as V
> V.fromList [V.fromList [1..5]]
[[1,2,3,4,5]]
But if I try with unboxed vectors:
> import qualified Data.Vector.Unboxed as U
> U.fromList [U.fromList [1..5]]
I get the following error:
• Non type-variable argument
in the constraint: U.Unbox (U.Vector a)
(Use FlexibleContexts to permit this)
• When checking the inferred type
it :: forall a.
(U.Unbox (U.Vector a), U.Unbox a, Num a, Enum a) =>
U.Vector (U.Vector a)
I suspect it has something to do with this:
> V.fromList [1..5]
[1,2,3,4,5]
whereas
> U.fromList [1..5]
[1.0,2.0,3.0,4.0,5.0]
But I can't seem to understand how to avoid this.
Thanks in advance!