[Haskell-cafe] Is there a generic way to detect "mzero"?

Tobias Brandt tob.brandt at googlemail.com
Mon Mar 26 21:20:00 CEST 2012

On 26 March 2012 20:33, Ting Lei <tinlyx at hotmail.com> wrote:

> can :: (MonadPlus m) => (a -> m b) -> a -> Bool
> can f x = case f x of
>             mzero -> False
>             _ -> True

In the first pattern `mzero' is just a variable and matches
anything, as does `_'. So, naturally, both patterns overlap.

I don't see any way to write this without requiring `Eq m'.

More information about the Haskell-Cafe mailing list