Community
Modules 24

Control.Monad.Trans.Select

experimental

Selection monad transformer, modelling search algorithms.

The Select monad

type Select r = SelectT r Identity

The selection monad, which is non-strict.

select :: ((a -> r) -> a) -> Select r a

Constructor for computations in the selection monad.

runSelect :: Select r a -> (a -> r) -> a

Runs a Select computation with a function for evaluating answers to select a particular answer. (The inverse of select.)

mapSelect :: (a -> a) -> Select r a -> Select r a

Apply a function to transform the result of a selection computation.

  • runSelect (mapSelect f m) = f . runSelect m

The SelectT monad transformer

newtype SelectT r m a

Selection monad transformer.

SelectT is not a functor on the category of monads, and many operations cannot be lifted through it.

SelectT r m is strict if and only if m is.

SelectT :: (a -> m r) -> m a -> SelectT r m a

runSelectT :: SelectT r m a -> (a -> m r) -> m a

Runs a SelectT computation with a function for evaluating answers to select a particular answer.

mapSelectT :: (m a -> m a) -> SelectT r m a -> SelectT r m a

Apply a function to transform the result of a selection computation. This has a more restricted type than the map operations for other monad transformers, because SelectT does not define a functor in the category of monads.

  • runSelectT (mapSelectT f m) = f . runSelectT m

Monad transformation

selectToContT :: (Monad m) => SelectT r m a -> ContT r m a

Convert a selection computation to a continuation-passing computation.

Instances

9
  • instance (Generic r, Generic m, Generic a) => Generic (SelectT r m a)
  • instance (Functor m) => Functor (SelectT r m)
  • instance (Functor m, Monad m) => Applicative (SelectT r m)
  • instance (Functor m, MonadPlus m) => Alternative (SelectT r m)
  • instance (Monad m) => Monad (SelectT r m)
  • instance (Fail.MonadFail m) => Fail.MonadFail (SelectT r m)
  • instance (MonadPlus m) => MonadPlus (SelectT r m)
  • instance MonadTrans (SelectT r)
  • instance (MonadIO m) => MonadIO (SelectT r m)
Maintainer
R.Paterson@city.ac.uk
Portability
portable
Copyright
(c) Ross Paterson 2017
License
BSD-style (see the file LICENSE)
Build record and source files

Community contribution. The service has not verified this documentation.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-858b1951-web-1

Metadata snapshot: ac77ab7d2b1e88487eeab41661abedb7bfb8bc846deb92e7874c08d166bff65d

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.