On Sat, Dec 3, 2011 at 3:55 PM, Antoine Latter <[email protected]> wrote: > On Sat, Dec 3, 2011 at 10:55 AM, edgar klerks <[email protected]> wrote: >> Hi list, >> >> I am using MonadSplit >> (from http://www.haskell.org/haskellwiki/New_monads/MonadSplit ) for a >> project and now I want to make a library out of it. This seems to be >> straightforward, but I got stuck when I tried to move miszero out of the >> class: >> >> miszero :: m a -> Bool >> >> It tests if the provided monad instance is empty. My naive attempt was: >> > > You can write: > > miszero :: MonadPlus m => m a -> m Bool > miszero m = (m >> return False) <|> return True > > but that will invoke any monadic effects as well as determining the > nature of the value, which may not be what you want.
It's almost certainly not what you want for the list monad. -- Dave Menendez <[email protected]> <http://www.eyrie.org/~zednenem/> _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
