definitive-base-2.6.3: A small Prelude wrapper to simplify my own Haskell developments

Safe HaskellNone
LanguageHaskell2010

Algebra.Monad.Base

Contents

Synopsis

Documentation

Monad utilities

newtype Kleisli m a b Source #

Constructors

Kleisli 

Fields

Instances

Monad m => Split (Kleisli m) Source # 

Methods

(<#>) :: Kleisli m a c -> Kleisli m b d -> Kleisli m (a, b) (c, d) Source #

Monad m => Choice (Kleisli m) Source # 

Methods

(<|>) :: Kleisli m a c -> Kleisli m b c -> Kleisli m (a :+: b) c Source #

Monad m => Category (Kleisli m) Source # 

Methods

id :: Kleisli m a a Source #

Monad m => Deductive (Kleisli m) Source # 

Methods

(.) :: Kleisli m b c -> Kleisli m a b -> Kleisli m a c Source #

Monad m => Apply (Kleisli m) Source # 

Methods

apply :: Kleisli m (Kleisli m a b, a) b Source #

Monad m => Arrow (Kleisli m) Source # 

Methods

arr :: (a -> b) -> Kleisli m a b Source #

Functor f => Functor (Kleisli f a) Source # 

Methods

map :: (a -> b) -> Kleisli f a a -> Kleisli f a b Source #

Contravariant f => Contravariant (Kleisli f a) Source # 

Methods

collect :: Functor f => f (Kleisli f a a) -> Kleisli f a (f a) Source #

Isomorphic (a -> m b) (c -> m' d) (Kleisli m a b) (Kleisli m' c d) Source # 

Methods

i'_ :: Iso (Kleisli m' c d) (Kleisli m a b) (c -> m' d) (a -> m b) Source #

i'Kleisli :: Iso (Kleisli m a b) (Kleisli m' c d) (a -> m b) (c -> m' d) Source #

(=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 0 Source #

joinMap :: Monad m => (a -> m b) -> m a -> m b Source #

(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c Source #

(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c Source #

(>>) :: Applicative f => f a -> f b -> f b infixl 1 Source #

(<*=) :: Monad m => m a -> (a -> m b) -> m a infixl 1 Source #

only :: (Monoid (m ()), Monad m) => (a -> Bool) -> m a -> m a Source #

return :: Unit f => a -> f a Source #

foldlM :: (Foldable t, Monad m) => (a -> b -> m a) -> a -> t b -> m a Source #

foldrM :: (Foldable t, Monad m) => (b -> a -> m a) -> t b -> a -> m a Source #

findM :: (Foldable t, Monad m) => (a -> m (Maybe b)) -> t a -> m (Maybe b) Source #

while :: Monad m => m Bool -> m () Source #

until :: Monad m => m (Maybe a) -> m a Source #

bind2 :: Monad m => (a -> b -> m c) -> m a -> m b -> m c Source #

bind3 :: Monad m => (a -> b -> c -> m d) -> m a -> m b -> m c -> m d Source #

(>>>=) :: Monad m => (m a, m b) -> (a -> b -> m c) -> m c Source #

(>>>>=) :: Monad m => (m a, m b, m c) -> (a -> b -> c -> m d) -> m d Source #

mfix_ :: MonadFix m => (a -> m a) -> m () Source #

mfixing :: MonadFix f => (b -> f (a, b)) -> f a Source #

Instance utilities

newtype Compose' f g a Source #

Constructors

Compose' ((g :.: f) a) 

Instances

(Traversable f, Monad f, MonadWriter w g) => MonadWriter w (Compose' f g) Source # 

Methods

tell :: w -> Compose' f g () Source #

listen :: Compose' f g a -> Compose' f g (w, a) Source #

censor :: Compose' f g (a, w -> w) -> Compose' f g a Source #

(Traversable f, Monad f, MonadReader r g) => MonadReader r (Compose' f g) Source # 

Methods

ask :: Compose' f g r Source #

local :: (r -> r) -> Compose' f g a -> Compose' f g a Source #

(Traversable f, Monad f, MonadState s g) => MonadState s (Compose' f g) Source # 

Methods

get :: Compose' f g s Source #

put :: s -> Compose' f g () Source #

modify :: (s -> s) -> Compose' f g () Source #

Monad m => ConcreteMonad (Compose' m) Source # 

Methods

generalize :: Monad m => Compose' m Id a -> Compose' m m a Source #

Monad m => MonadTrans (Compose' m) Source # 

Methods

lift :: Monad m => m a -> Compose' m m a Source #

(Unit f, Unit g) => Unit (Compose' f g) Source # 

Methods

pure :: a -> Compose' f g a Source #

(Monad f, Traversable f, MonadFix g) => MonadFix (Compose' f g) Source # 

Methods

mfix :: (a -> Compose' f g a) -> Compose' f g a Source #

(Traversable g, Traversable f) => Traversable (Compose' f g) Source # 

Methods

sequence :: Applicative f => Compose' f g (f a) -> f (Compose' f g a) Source #

(Foldable f, Foldable g) => Foldable (Compose' f g) Source # 

Methods

fold :: Monoid m => Compose' f g m -> m Source #

(Monad f, Monad g, Traversable f) => Monad (Compose' f g) Source # 

Methods

join :: Compose' f g (Compose' f g a) -> Compose' f g a Source #

(>>=) :: Compose' f g a -> (a -> Compose' f g b) -> Compose' f g b Source #

(Applicative f, Applicative g) => Applicative (Compose' f g) Source # 
(SemiApplicative f, SemiApplicative g) => SemiApplicative (Compose' f g) Source # 

Methods

(<*>) :: Compose' f g (a -> b) -> Compose' f g a -> Compose' f g b Source #

(Functor f, Functor g) => Functor (Compose' f g) Source # 

Methods

map :: (a -> b) -> Compose' f g a -> Compose' f g b Source #

(Monoid (f a), Applicative g) => Monoid (Compose' f g a) Source # 

Methods

zero :: Compose' f g a Source #

(Semigroup (f a), SemiApplicative g) => Semigroup (Compose' f g a) Source # 

Methods

(+) :: Compose' f g a -> Compose' f g a -> Compose' f g a Source #

i'Compose' :: Iso (Compose' f g a) (Compose' h i b) (g (f a)) (i (h b)) Source #

coerceJoin :: forall m m' a. Monad m => (forall b. m b -> m' b) -> m' (m' a) -> m' a Source #

coerceDuplicate :: forall m m' a. Comonad m => (forall b. m b -> m' b) -> m' a -> m' (m' a) Source #

Orphan instances

MonadIO IO Source # 

Methods

liftIO :: IO a -> IO a Source #

ConcreteMonad Backwards Source # 

Methods

generalize :: Monad m => Backwards Id a -> Backwards m a Source #

MonadTrans Backwards Source # 

Methods

lift :: Monad m => m a -> Backwards m a Source #

MonadFix [] Source # 

Methods

mfix :: (a -> [a]) -> [a] Source #

MonadFix IO Source # 

Methods

mfix :: (a -> IO a) -> IO a Source #

MonadFix Strict Source # 

Methods

mfix :: (a -> Strict a) -> Strict a Source #

MonadFix m => MonadFuture m (Backwards m) Source # 

Methods

future :: m a -> Backwards m a Source #

(Traversable g, Monad g, MonadWriter w f) => MonadWriter w ((:.:) f g) Source # 

Methods

tell :: w -> (f :.: g) () Source #

listen :: (f :.: g) a -> (f :.: g) (w, a) Source #

censor :: (f :.: g) (a, w -> w) -> (f :.: g) a Source #

(Traversable g, Monad g, MonadReader r f) => MonadReader r ((:.:) f g) Source # 

Methods

ask :: (f :.: g) r Source #

local :: (r -> r) -> (f :.: g) a -> (f :.: g) a Source #

(Traversable g, Monad g, MonadState s f) => MonadState s ((:.:) f g) Source # 

Methods

get :: (f :.: g) s Source #

put :: s -> (f :.: g) () Source #

modify :: (s -> s) -> (f :.: g) () Source #

(MonadIO m, MonadTrans t, Monad (t m)) => MonadIO (t m) Source # 

Methods

liftIO :: IO a -> t m a Source #

Monad m => ConcreteMonad ((:.:) m) Source # 

Methods

generalize :: Monad m => (m :.: Id) a -> (m :.: m) a Source #

Monad m => MonadTrans ((:.:) m) Source # 

Methods

lift :: Monad m => m a -> (m :.: m) a Source #

MonadFix ((->) b) Source # 

Methods

mfix :: (a -> b -> a) -> b -> a Source #

MonadFix (Either e) Source # 

Methods

mfix :: (a -> Either e a) -> Either e a Source #

Monoid b => MonadFix ((,) b) Source # 

Methods

mfix :: (a -> (b, a)) -> (b, a) Source #

MonadFix m => MonadFix (Backwards m) Source # 

Methods

mfix :: (a -> Backwards m a) -> Backwards m a Source #

MonadFix m => Monad (Backwards m) Source # 

Methods

join :: Backwards m (Backwards m a) -> Backwards m a Source #

(>>=) :: Backwards m a -> (a -> Backwards m b) -> Backwards m b Source #

(MonadFix f, Traversable g, Monad g) => MonadFix ((:.:) f g) Source # 

Methods

mfix :: (a -> (f :.: g) a) -> (f :.: g) a Source #

(Traversable g, Monad f, Monad g) => Monad ((:.:) f g) Source # 

Methods

join :: (f :.: g) ((f :.: g) a) -> (f :.: g) a Source #

(>>=) :: (f :.: g) a -> (a -> (f :.: g) b) -> (f :.: g) b Source #