[Haskell-cafe] Point-free style

Remi Turk rturk at science.uva.nl
Mon Feb 14 10:35:16 EST 2005


On Mon, Feb 14, 2005 at 03:55:01PM +0100, Lennart Augustsson wrote:
> Any definition can be made point free if you have a
> complete combinator base at your disposal, e.g., S and K.
> 
> Haskell has K (called const), but lacks S.  S could be
> defined as
>   spread f g x = f x (g x)
> 
> Given that large set of Haskell prelude functions I would
> not be surprised if spread could already be defined point
> free in Haskell. :)
> 
> 	-- Lennart

I hope this won't be considered cheating...

import Control.Monad.Reader

k :: a -> b -> a
k = return

s :: (a -> r -> b) -> (a -> r) -> a -> b
s = flip (>>=) . flip

Greetings,
Remi

-- 
Nobody can be exactly like me. Even I have trouble doing it.


More information about the Haskell-Cafe mailing list