haskell - How to read "Num (a -> b -> a) => a -> [b] -> a" definition -
i'm trying head around haskell function definitions. took foldl function it's definition being
:t foldl foldl :: (a -> b -> a) -> -> [b] -> now first argument function, if pass it, here's what's left:
:t foldl (+) foldl (+) :: num b => b -> [b] -> b which read "a function takes numeric value , returns function takes array".
now, first argument function? can read
foldl :: -> b -> -> -> [b] -> instead?
i tried passing 1 numeric value, , here's i've got:
foldl 4 :: num (a -> b -> a) => -> [b] -> and question is.. how read this? not understand i've got.
the first argument function , hence cannot read as: foldl :: -> b -> -> -> [b] -> a. because -> right associative means a -> b -> c a -> (b -> c) , different (a -> b) -> c
Comments
Post a Comment