functor-monad-0.1.1.0: FFunctor: functors on (the usual) Functors
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Trail

Description

Trail type which makes an ordinary Monad out of FMonad

Synopsis

Documentation

newtype Trail mm a Source #

For any FMonad mm, Trail mm is a Monad.

Example

Trail mm can become variantions of Monad for different FMonad mm.

  • mm = ComposePost m

    For any Monad m, Trail (ComposePost m) is isomorphic to m.

    Trail (ComposePost m) a
      ~ ComposePost m ((,) a) ()
      ~ m (a, ())
      ~ m a
    
  • mm = Free

    Trail Free is isomorphic to the list monad [].

    Trail Free a
      ~ Free ((,) a) ()
      ~ [a]
    
  • mm = FreeT' m

    For any Monad m, Trail (FreeT' m) is isomorphic to ListT m, where ListT is so-called "ListT done right."

    Trail (FreeT' m) a
      ~ FreeT ((,) a) m ()
      ~ ListT m a
    

    See more for examples/ListTVia.hs

Constructors

Trail 

Fields

Instances

Instances details
FMonad mm => Applicative (Trail mm) Source # 
Instance details

Defined in Control.Monad.Trail

Methods

pure :: a -> Trail mm a #

(<*>) :: Trail mm (a -> b) -> Trail mm a -> Trail mm b #

liftA2 :: (a -> b -> c) -> Trail mm a -> Trail mm b -> Trail mm c #

(*>) :: Trail mm a -> Trail mm b -> Trail mm b #

(<*) :: Trail mm a -> Trail mm b -> Trail mm a #

FFunctor mm => Functor (Trail mm) Source # 
Instance details

Defined in Control.Monad.Trail

Methods

fmap :: (a -> b) -> Trail mm a -> Trail mm b #

(<$) :: a -> Trail mm b -> Trail mm a #

FMonad mm => Monad (Trail mm) Source # 
Instance details

Defined in Control.Monad.Trail

Methods

(>>=) :: Trail mm a -> (a -> Trail mm b) -> Trail mm b #

(>>) :: Trail mm a -> Trail mm b -> Trail mm b #

return :: a -> Trail mm a #