initial commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
{-# LANGUAGE NoImplicitPrelude #-}
|
||||
|
||||
module Monad (
|
||||
Monad(..)
|
||||
, MonadPlus(..)
|
||||
|
||||
, (=<<)
|
||||
, (>=>)
|
||||
, (<=<)
|
||||
, forever
|
||||
|
||||
, join
|
||||
, mfilter
|
||||
, filterM
|
||||
, mapAndUnzipM
|
||||
, zipWithM
|
||||
, zipWithM_
|
||||
, foldM
|
||||
, foldM_
|
||||
, replicateM
|
||||
, replicateM_
|
||||
, concatMapM
|
||||
|
||||
, guard
|
||||
, when
|
||||
, unless
|
||||
|
||||
, liftM
|
||||
, liftM2
|
||||
, liftM3
|
||||
, liftM4
|
||||
, liftM5
|
||||
, liftM'
|
||||
, liftM2'
|
||||
, ap
|
||||
|
||||
, (<$!>)
|
||||
) where
|
||||
|
||||
import Prelude (concat, seq)
|
||||
import Control.Monad
|
||||
|
||||
concatMapM :: (Monad m) => (a -> m [b]) -> [a] -> m [b]
|
||||
concatMapM f xs = liftM concat (mapM f xs)
|
||||
|
||||
liftM' :: Monad m => (a -> b) -> m a -> m b
|
||||
liftM' = (<$!>)
|
||||
{-# INLINE liftM' #-}
|
||||
|
||||
liftM2' :: (Monad m) => (a -> b -> c) -> m a -> m b -> m c
|
||||
liftM2' f a b = do
|
||||
x <- a
|
||||
y <- b
|
||||
let z = f x y
|
||||
z `seq` return z
|
||||
{-# INLINE liftM2' #-}
|
||||
Reference in New Issue
Block a user