* Add total ConvertText alternative to Conv * Explain ConvertText's meaning * Rename convertText to toS for compatibility * 0.3.0 Refactor (#111) * Begin work on 0.3 refactor * Remove old docs folder * Fix dodgy exports * 4.8 constraint for null and length * Guards for Semigroup export for base<4.9 * Fix Data.Bits exports * Guards for typeable exports * Remove unused pragmas * Update hlint.yaml * Use liftM because of pre-AMP quirkk * Data.Char exports * Rework Exception exports * Fix bounds * Adding Monad.Fail shim * Fix displayException export * Explicit GHC.Prim import for ancient ghc * Explicit raise# for base-4.7 * Flush legacy testing infrastructure * Update git location * Update README * Add Partial module * Add concurrency exports * Explicit GHC.Float exports * Bounds for threadWaitReadSTM, threadWaitWriteSTM, forkOSWithUnmask * Fix for weird undocumented underflowError weirdness * forkOSWithUnask for base>4.8 * Fix GHC.Real exports pre base-4.7 * Fix withMVarMasked for base-4.7 * Update nix derivation * Update derivation * Update derivation * Explicit functor exports * <$ export * Overwrite binary * Fix some missing exports * Update Changelog * Minor export fixes base<4.9 * Explicit exports * Export handler * Generate export lists for multiple versions (#114) * Generate export lists for #112 * Make export lists format OccName uniformly * Make compile on ancient GHC * Use Foldable.concat * Hacks to make ghc-7.6 API happy * liftIO shim * Fix sortOn warning * Update ChangeLog * Update base bounds * Export conventions * Update Haddocks * Document GHC magic
70 lines
1.0 KiB
Haskell
70 lines
1.0 KiB
Haskell
{-# LANGUAGE CPP #-}
|
|
{-# LANGUAGE Trustworthy #-}
|
|
{-# LANGUAGE NoImplicitPrelude #-}
|
|
|
|
module Protolude.Monad (
|
|
Monad((>>=), return)
|
|
, MonadPlus(mzero, mplus)
|
|
|
|
, (=<<)
|
|
, (>=>)
|
|
, (<=<)
|
|
, (>>)
|
|
, 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 Protolude.Base (seq)
|
|
import Data.List (concat)
|
|
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' #-}
|
|
|
|
#if !MIN_VERSION_base(4,8,0)
|
|
(<$!>) :: Monad m => (a -> b) -> m a -> m b
|
|
f <$!> m = do
|
|
x <- m
|
|
let z = f x
|
|
z `seq` return z
|
|
{-# INLINE (<$!>) #-}
|
|
#endif
|