[Haskell-cafe] maybeToM

Joachim Breitner mail at joachim-breitner.de
Mon Dec 18 12:24:28 EST 2006


Am Montag, den 18.12.2006, 18:12 +0100 schrieb Tomasz Zielonka:
> On Mon, Dec 18, 2006 at 04:59:45PM +0000, Joachim Breitner wrote:
> > Well, that???s a possible implementation of a maybeToM. The question is:
> > Is it useful enough for a name on it???s own?
> ...and for putting it in Prelude?

Actually, I’d not put it in Prelude, just Data.Maybe, along the other
Maybe related functions.

> It would be interesting to try to estimate the number of functions
> useful enough for putting in Prelude - I am starting to be afraid
> that there will be too many of them.
> One of the nice things about functional languages is that you can create
> such functions by combining higher-order functions, without the need to
> name the resulting function.

Well, maybeToM could be a glue function that, if it appears in the code
at all, probably appears a lot of time, so it will have to be named. And
if it has to be named, you can name it once for all.

Another point is that the presence of the function alone might inspire
people to use it in ways that they would not even think of. Until a very
recent post here or on planet I would not have thought of using pattern
matching failures deliberately to fail one part of a List computation.
So giving such a function a name advocates a certain use.

Joachim Breitner
  e-Mail: mail at joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  ICQ#: 74513189

More information about the Haskell-Cafe mailing list