Benjamin Franksen writes:
> On Monday 01 November 2004 23:40, Jon Fairbairn wrote:
> > Apart from matching up with the names there's not much to
> > choose between one destructor and many, except possibly when
> > one considers something like:
> >
> > Â Âcase e of
> > Â Â ÂSquare s -> ...
> > Â Â Â_ -> ...
> >
> > particularly if the type has more than two constructors.
>
> True. Anyway, we don't really want to abandon pattern matching
> syntax, do we?
Explicit destructor functions are nice when working in a point-free
fashion. Consider these:
c1 = someComputation >>= maybe mzero return
c2 = do
x <- someComputation
case x of
Just x' -> return x'
Nothing -> mzero
On the other hand, this function (which I actually have in my code) may
be over-doing it:
swap = maybe (Right Nothing) (either Left (Right . Just))
--
David Menendez <[EMAIL PROTECTED]> <http://www.eyrie.org/~zednenem/>
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe