import Control Monad guard MonadPlus Bool guard True return guard Fals

1
2
3
4
5
6
7
import Control.Monad
guard :: (MonadPlus m) => Bool -> m ()
guard True = return ()
guard False = mzero
x `zeroMod` n = Control.Monad.guard ((x `mod` n) == 0) >> return x