monad-choice-0.2.0.0: Monad, monad transformer, and typeclass representing choices.

Copyright(c) Eamon Olive 2020
(c) Louis Hyde 2020
LicenseAGPL-3
Maintainerejolive97@gmail.com
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Trans.Choice.Covariant

Description

 
Synopsis

Documentation

data ChoiceT f m a Source #

Instances
MonadRWS r w s m => MonadRWS r w s (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

MonadWriter w m => MonadWriter w (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

writer :: (a, w) -> ChoiceT f m a #

tell :: w -> ChoiceT f m () #

listen :: ChoiceT f m a -> ChoiceT f m (a, w) #

pass :: ChoiceT f m (a, w -> w) -> ChoiceT f m a #

MonadState s m => MonadState s (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

get :: ChoiceT f m s #

put :: s -> ChoiceT f m () #

state :: (s -> (a, s)) -> ChoiceT f m a #

MonadReader r m => MonadReader r (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

ask :: ChoiceT f m r #

local :: (r -> r) -> ChoiceT f m a -> ChoiceT f m a #

reader :: (r -> a) -> ChoiceT f m a #

MonadChoice f (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

choose :: f a -> ChoiceT f m a Source #

MonadTrans (ChoiceT f) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

lift :: Monad m => m a -> ChoiceT f m a #

Monad (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

(>>=) :: ChoiceT f m a -> (a -> ChoiceT f m b) -> ChoiceT f m b #

(>>) :: ChoiceT f m a -> ChoiceT f m b -> ChoiceT f m b #

return :: a -> ChoiceT f m a #

fail :: String -> ChoiceT f m a #

Functor (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

fmap :: (a -> b) -> ChoiceT f m a -> ChoiceT f m b #

(<$) :: a -> ChoiceT f m b -> ChoiceT f m a #

Applicative (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

pure :: a -> ChoiceT f m a #

(<*>) :: ChoiceT f m (a -> b) -> ChoiceT f m a -> ChoiceT f m b #

liftA2 :: (a -> b -> c) -> ChoiceT f m a -> ChoiceT f m b -> ChoiceT f m c #

(*>) :: ChoiceT f m a -> ChoiceT f m b -> ChoiceT f m b #

(<*) :: ChoiceT f m a -> ChoiceT f m b -> ChoiceT f m a #

MonadIO m => MonadIO (ChoiceT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Choice.Covariant

Methods

liftIO :: IO a -> ChoiceT f m a #

runChoiceT :: Monad m => (forall x. f x -> m x) -> ChoiceT f m a -> m a Source #

mapChoiceT :: (forall x. m x -> n x) -> ChoiceT f m a -> ChoiceT f n a Source #

runBacktrackableChoiceT Source #

Arguments

:: Monad m 
=> (forall x. f x -> m (Maybe x))

The selection function. If the result of the outputted computation is Nothing then runBacktrackableChoiceT will backtrack to the previous choice. Otherwise, the result is a Just then it will proceed like runChoiceT.

-> ChoiceT f m a

The choice structure to run

-> m (Maybe a)

The resulting computation. If the selection function backtracks on the first choice the result of the computation will be Nothing.

A variant of runChoiceT that allows for the selection function to output Nothing to represent the desire to potentially select a different option for the previous choice.