[Haskell-beginners] Question on evaluating function compostion

Erik Price erikprice at gmail.com
Thu Aug 21 14:37:38 UTC 2014


>
> Why did Haskell, however, not try to fully evaluate addition,
> like following?
> (liftM . (+)) 1 [2]   --->
>   liftM ((+) 1 [2])   --->
>   error
>

Haskell functions only consume one argument, not two. The composed function
is applied to the first argument, which is 1. That returns a new function,
which is applied to the next argument, which is [2].

e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140821/88f2cf53/attachment.html>


More information about the Beginners mailing list