Tomasz Zielonka wrote:
On Sun, Feb 12, 2006 at 01:57:07PM +0100, Daniel Fischer wrote:
Your above parser would be

option Nothing (fmap Just p) -- or you might use liftM.

Both are easy enough. If you think the naming is unfortunate, I wouldn't flatly contradict, but it's too late now, I believe.

They are easy, but writing "option Nothing (liftM Just p)" for the nth
time tends to be boring. I could write my own combinator, but all the
good names are already taken. I too wish optional returned (Maybe a)
and I wonder how many programs would be broken if it was changed now.

The only programs it would break are those that specify it at the end (they'd require an extra "return ()", right?

This brings me to wonder also if it'd be possible for the compilers to add a little bit more smarts to the "do" notation syntax, so that it'll add the return () at the end if it's missing. Maybe too much to ask of the Haskell crowd :).

In any case... I called them "optionalKeep" and "manyTillKeep". As in... "keep the result".

  Thanx! It's good to know it's not just me.

JCAB

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to