(過去記事のコピペ 2013/07/14)
実はHaskellには型を推定してくれる機能があるのだ
hoge x = x * 2
とソースに書いておいて、
*Main> :t hoge hoge :: Num a => a -> a
zipWith2 _ [] _ = [] zipWith2 _ _ [] = [] zipWith2 f (x:xs) (y:ys) = f x y : zipWith2 f xs ys
こんな関数でも?
*Main> :t zipWith2 zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
大丈夫です。