This may be a fairly simple question, but I searched around and I can not find the answer.
I would like to present a 2D list using unboxed Vectors. This is easy to do with normal vectors:
> import qualified Data.Vector as V
> V.fromList [V.fromList [1..5]]
[[1,2,3,4,5]]
But if I try to use unpacked 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 this has something to do with this:
> V.fromList [1..5]
[1,2,3,4,5]
then
> U.fromList [1..5]
[1.0,2.0,3.0,4.0,5.0]
But I can’t figure out how to avoid this.
Thanks in advance!