インスタンスに関する以前の質問に続いてData.Vector.Generic.Vector
、なぜだろうと思い始めました。
zipWith :: (Vector v a, Vector v b, Vector v c)
=> (a -> b -> c) -> v a -> v b -> v c
zipWith f xs ys = unstream (Stream.zipWith f (stream xs) (stream ys))
そしてそうではない
zipWith :: (GV.Vector v1 a, GV.Vector v2 b, GV.Vector v3 c)
=> (a -> b -> c) -> v1 a -> v2 b -> v3 c
zipWith f xs ys = unstream (Stream.zipWith f (stream xs) (stream ys))
?
2番目のものは問題なくコンパイルされます。そのようなすべての機能を 1 つのインスタンスに制限する特定の理由はありますか? なぜなら、私にとって
v1 = Data.Vector.fromList [1,2,3,4,5]
v2 = Data.Vector.Unboxed.fromList [6,7,8,9] :: Data.Vector.Unboxed.Vector Int
v3 = foo (*) v1 v2 :: Data.Vector.Unboxed.Vector Int
v4 = foo (*) v1 v2 :: Data.Vector.Vector Int
はるかに「一般的」に見えます。