> I've always thought that being able to write: > >> catMaybes :: [Maybe a] -> [a] >> catMaybes xs = [ x | Just x <- xs ] > > is really cool, which relies on: > >> fail _ = [] > > being in the Monad instance for List.
Really? I thought that's just a feature of list comprehensions. List comps are not monads, at least not any more. If you wrote it as: catMaybes xs = do Just x <- xs return x Then yes, I believe that uses 'fail'. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe