`liftM dec . mapM (flip M.lookup decodeMap)`

]]>`fmap`

or `<$>`

would indeed make it even shorter and sweeter. I suspect I’ll have to play a bit more with Haskell, and read up on what `Control.Applicative`

has to offer.
*Ricardo*, I suspect there are two back-ticks missing, right?

Right! The title of the paper says it all: “How to convert failure into a list of successes.”

Maybe is like the list monad except that (:) on anything other than [] is a no-op.

]]>`mapM`

in place of your combination of `sequence`

and `map`

.
I think of it as “map, sequenced within the monad”. If you think about how IO would use it (“do each of these operations in sequence, collecting the results”) it makes the translation into the Maybe monad more obvious.
I’d maybe write your code as as:
`decode = liftM dec . mapM (flip M.lookup decodeMap)`

`mapM f = sequence . map f`

`liftM`

can be replaced by the more abstract `fmap`

, or even better: the applicative combinator `<$>`

.

And we can strip `flip`

by using a section:

`dec <$> mapM (`

``M.lookup`

` `decodeMap) s`

`M.lookup`

decodeMap)
]]>