[Haskell-cafe] mapOfmap & composition

Benjamin Franksen benjamin.franksen at bessy.de
Fri Dec 9 11:45:04 EST 2005


On Friday 09 December 2005 17:31, Christian Maeder wrote:
> raptor wrote:
> > And second why when I try do do function composition i.e. :
> >
> > newf = map . f
> >
> > But this works :
> >
> > newf x = map (f x)
>
> Does f has constraints? It should work with a type signature.

To elaborate this very short comment: The above definition for newf is 
rejected because of the (infamous) monomorphism restriction. Either 
supply a type signature or an argument so that Haskell knows you want 
to define a function, not data.

Ben


More information about the Haskell-Cafe mailing list