smash-0.1.2: Combinators for Maybe types
Copyright(c) 2020-2021 Emily Pillmore
LicenseBSD-3-Clause
MaintainerEmily Pillmore <emilypi@cohomolo.gy>
StabilityExperimental
PortabilityNon-portable
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Trans.Can

Description

This module contains utilities for the monad transformer for the pointed product.

Synopsis

Monad Transformer

newtype CanT a m b Source #

A monad transformer for the pointed product, parameterized by:

  • a - the value on the left
  • b - the value on the right
  • m - The monad over a pointed product (see: Can).

This monad transformer is similar to TheseT, except with the possibility of an empty unital value.

Constructors

CanT 

Fields

Instances

Instances details
(Semigroup t, MonadRWS r w s m) => MonadRWS r w s (CanT t m) Source # 
Instance details

Defined in Control.Monad.Trans.Can

(Semigroup a, MonadWriter w m) => MonadWriter w (CanT a m) Source # 
Instance details

Defined in Control.Monad.Trans.Can

Methods

writer :: (a0, w) -> CanT a m a0 #

tell :: w -> CanT a m () #

listen :: CanT a m a0 -> CanT a m (a0, w) #

pass :: CanT a m (a0, w -> w) -> CanT a m a0 #

(MonadState s m, Semigroup t) => MonadState s (CanT t m) Source # 
Instance details

Defined in Control.Monad.Trans.Can

Methods

get :: CanT t m s #

put :: s -> CanT t m () #

state :: (s -> (a, s)) -> CanT t m a #

(Semigroup a, MonadReader r m) => MonadReader r (CanT a m) Source # 
Instance details

Defined in Control.Monad.Trans.Can

Methods

ask :: CanT a m r #

local :: (r -> r) -> CanT a m a0 -> CanT a m a0 #

reader :: (r -> a0) -> CanT a m a0 #

(MonadError e m, Semigroup e) => MonadError e (CanT e m) Source # 
Instance details

Defined in Control.Monad.Trans.Can

Methods

throwError :: e -> CanT e m a #

catchError :: CanT e m a -> (e -> CanT e m a) -> CanT e m a #

MonadTrans (CanT a) Source # 
Instance details

Defined in Control.Monad.Trans.Can

Methods

lift :: Monad m => m a0 -> CanT a m a0 #

(Semigroup a, Monad m) => Monad (CanT a m) Source # 
Instance details

Defined in Control.Monad.Trans.Can

Methods

(>>=) :: CanT a m a0 -> (a0 -> CanT a m b) -> CanT a m b #

(>>) :: CanT a m a0 -> CanT a m b -> CanT a m b #

return :: a0 -> CanT a m a0 #

Functor f => Functor (CanT a f) Source # 
Instance details

Defined in Control.Monad.Trans.Can

Methods

fmap :: (a0 -> b) -> CanT a f a0 -> CanT a f b #

(<$) :: a0 -> CanT a f b -> CanT a f a0 #

(Semigroup a, Applicative f) => Applicative (CanT a f) Source # 
Instance details

Defined in Control.Monad.Trans.Can

Methods

pure :: a0 -> CanT a f a0 #

(<*>) :: CanT a f (a0 -> b) -> CanT a f a0 -> CanT a f b #

liftA2 :: (a0 -> b -> c) -> CanT a f a0 -> CanT a f b -> CanT a f c #

(*>) :: CanT a f a0 -> CanT a f b -> CanT a f b #

(<*) :: CanT a f a0 -> CanT a f b -> CanT a f a0 #

Combinators

mapCanT :: (m (Can a b) -> n (Can c d)) -> CanT a m b -> CanT c n d Source #

Map both the left and right values and output of a computation using the given function.