[Haskell-cafe] Re: Very crazy

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Tue Sep 25 07:33:13 EDT 2007


Andrew Coppin <andrewcoppin <at> btinternet.com> writes:

> I just found it rather surprising. Every time *I* try to compose with 
> functions of more than 1 argument, the type checker complains. 
> Specifically, suppose you have
> 
>   foo = f3 . f2 . f1
> 
> Assuming those are all 1-argument functions, it works great. But if f1 
> is a *two* argument function (like map is), the type checker refuses to 
> allow it, and I have to rewrite it as
> 
>   foo x y = f3 $ f2 $ f1 x y
> 
Look at the type of (.).(.) which should tell you how to compose functions 
with more than one variable. Mind you, I don't think it improves readability.

Dominic.



More information about the Haskell-Cafe mailing list