[Haskell-cafe] MonadList?

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Wed Sep 13 17:51:39 EDT 2006


Michael Shulman wrote:
> 
> class MonadList m where
>    option :: [a] -> m a
[...]

There's no need for an extra class, it can be done with MonadPlus:

option :: MonadPlus m => [a] -> m a
option = msum . map return

This definition came up before, for example here:
   http://www.haskell.org/haskellwiki/Sudoku

enjoy,

Bertram


More information about the Haskell-Cafe mailing list