Hi,

dons mentions in his blog post that Data.Map’s lookup is generalized
over the Monads, whereas Prelude.maybe isn’t. Are there good reasons not
to do that to Prelude.maybe as well?

Alternatively, how about adding this function to Data.Maybe, analogous
to maybeToList

> maybeToM Nothing  = fail "Nothing"
> maybeToM (Just x) = return x

(Incidentially, this function is the same as maybeToList if run in the
List Monad).

This way, Prelude.lookup (or any function that returns a Maybe) can be
generalized as (maybeToM . lookup).

Greetings,
Joachim


-- 
Joachim "nomeata" Breitner
  mail: [EMAIL PROTECTED] | ICQ# 74513189 | GPG-Key: 4743206C
  JID: [EMAIL PROTECTED] | http://www.joachim-breitner.de/
  Debian Developer: [EMAIL PROTECTED]
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to