
27 Jan
2009
27 Jan
'09
1:31 p.m.
Tom Poliquin wrote:
add :: (b -> Int) -> (b -> Int) -> (b -> Int) add f g b = f b + g b
The program compiles and runs and produces '19' !
For fun I loaded into ghci and got what I believe is the proper type ..
*Main> :t add add :: (b -> Int) -> (b -> Int) -> b -> Int
When I try the same thing with something simpler (leaving a bit off the type definition) I get the expected error (by me) ..
In type expressions, the symbol -> is right-associative. So ... -> (b -> Int) is exactly the same as ... -> b -> Int -Yitz