Point-Free Style : Haskell doesn't like it ?

Derek Elkins ddarius@hotpop.com
Mon, 5 May 2003 00:59:12 -0400


On Mon, 05 May 2003 13:11:49 +0900
Ahn Ki-yung <kyagrd@bawi.org> wrote:

> I wan't to know why Haskell doesn't like pooint-free style.
> 
> For example, 0) and 1) are Unresolved top-level overloading,
> but 2) is accepted by the type system.
> 
> 0) show' = show
> 1) show' = (\x->show x)
> 2) show x = show x
> 
> What are the differences between 0), 1) and 2) ?
> They must have the same type.

And 0 and 1 must have a monomorphic type.  This is the monomorphism
restriction that is a fact of life with Haskell.  You don't have to
completely eta expand (as in the cut other example).  As an alternative
to eta expansion you can simply provide the type.  Finally, there is a
GHC option (and probably something similar for others) that will remove
the monomorphism restriction, but I imagine it may cause problems.