I'm starting to learn Haskell, but I'm finding it hard to figure out the small, little things that the tutorials jumps over. Right now I'm working with tuples in the form of Vector.Fixed:
import qualified Data.Vector.Fixed as VF
import qualified Data.Vector.Fixed.Unboxed (Vec 2)
import qualified Data.Vector.Unboxed as VU
let a = VF.mk2 7 7 :: (Int, Int)
let b = VF.mk2 7 7 :: (Vec2 Int)
What's difference between
a
andb
?How can I make a VF vector
f
equivalent of[a, a] = [(7,7), (7,7)]
?How can I make a VU vector
g
equivalent of[[a], [a,a]] = [[(7,7)], [(7,7), (7,7)]]
?
For question 2 and 3, I can't get past the type errors when trying to use the convert
function.
I know that my tuples always will be of length 2, but I need a list (or whatever)
f
of tuples that can be fixed size, and anotherg
that is two-dimensional (e.g.[[(1,2),(3,4)],[(1,2)]]
where neither the top list nor the sub lists can be of fixed size. Should I stick to the same type forf
andg
?Data.Vector.Fixed and Data.Vector.Unboxed both seem to come from the same package, but they have different maintainers. Are they both official, so to speak, or do they not share any similarities other than that they both are vector implementations?