On Sun, Apr 18, 2010 at 10:25 AM, Sean Leather <[email protected]> wrote:
> > >> This is the annoying part about Haskell . I can not understand composition >> . >> > > One of the ways of understanding composition (and many other functions in > Haskell) is by trying to understand its type. Here it is shown by looking at > the type in the interpreter GHCi. > > *Main> :t (.) > (.) :: (b -> c) -> (a -> b) -> a -> c > > It's a function that takes three arguments, the first two of which are > functions, and the third is something else. > As you mention below the function arrow (->), is right associative. For this reason I like to think of the above function as binary, instead of a function of 3 arguments. Making the associativity explicit we can rewrite it: (.) :: (b -> c) -> (a -> b) -> (a -> c) Now we can see that it is a binary function on functions. You're mileage may vary, but I find this form more intuitive. Jason
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
