Programming style (or: too clever by half?)

Andrew Pimlott andrew at
Wed Nov 12 17:37:49 EST 2003

On Wed, Nov 12, 2003 at 02:54:32PM +0000, Graham Klyne wrote:
> I just spotted a possible idiom for something that seems to pop up from 
> time to time:
>    foldr const
> But I can't help feeling that this code is perversely obscure.

Clever.  I usually end up with something like

    listToMaybe list `orMaybe` default

    orMaybe (Just x) _  = x
    orMaybe Nothing  y  = y


More information about the Haskell-Cafe mailing list