The capability to search with backtracking. Essentially describes a 'policy function': given the state of the search (and a 'ranking' or 'evaluation' of each possible result so far), pick the result that's currently best.
Laws
Any instance of MonadSelect must follow these laws:
Methods
select :: ((a -> r) -> a) -> m a
Instances16MonadSelect, …
MonadSelect r m => MonadSelect r (MaybeT m)Defined in mtl-2.3.1 · Control.Monad.SelectMonadSelect r (SelectT r Identity)Defined in mtl-2.3.1 · Control.Monad.SelectMonadSelect r m => MonadSelect r (ExceptT e m)Defined in mtl-2.3.1 · Control.Monad.SelectMonadSelect r m => MonadSelect r (IdentityT m)Defined in mtl-2.3.1 · Control.Monad.SelectMonadSelect r' m => MonadSelect r' (ReaderT r m)Defined in mtl-2.3.1 · Control.Monad.SelectProvides a read-only environment of type
rto the 'strategy' function. However, the 'ranking' function (or more accurately, representation) has no access tor. Put another way, you can influence what values get chosen by changingr, but not how solutions are ranked.MonadSelect w m => MonadSelect w (StateT s m)Defined in mtl-2.3.1 · Control.Monad.Select'Readerizes' the state: the 'ranking' function can see a value of type
s, but not modify it. Effectively, can be thought of as 'extending' the 'ranking' by all values ins, but whichsgets given to any rank calls is predetermined by the 'outer state' (and cannot change).MonadSelect w m => MonadSelect w (StateT s m)Defined in mtl-2.3.1 · Control.Monad.Select'Readerizes' the state: the 'ranking' function can see a value of type
s, but not modify it. Effectively, can be thought of as 'extending' the 'ranking' by all values ins, but whichsgets given to any rank calls is predetermined by the 'outer state' (and cannot change).MonadSelect w' m => MonadSelect w' (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Select'Readerizes' the writer: the 'ranking' function can see the value that's been accumulated (of type
w), but can't add anything to the log. Effectively, can be thought of as 'extending' the 'ranking' by all values ofw, but whichwgets given to any rank calls is predetermined by the 'outer writer' (and cannot change).(MonadSelect r m, Monoid w) => MonadSelect r (AccumT w m)Defined in mtl-2.3.1 · Control.Monad.Select'Readerizes' the accumulator: the 'ranking' function can see the value that has been accumulated (of type
w), but can't add anything to it. Effectively, can be thought of as 'extending' the 'ranking' by all values ofw, but whichwgets given to any rank calls is predetermined by the 'outer accumulation' (and cannot change).(MonadSelect w' m, Monoid w) => MonadSelect w' (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Select'Readerizes' the writer: the 'ranking' function can see the value that's been accumulated (of type
w), but can't add anything to the log. Effectively, can be thought of as 'extending' the 'ranking' by all values ofw, but whichwgets given to any rank calls is predetermined by the 'outer writer' (and cannot change).(MonadSelect w' m, Monoid w) => MonadSelect w' (WriterT w m)Defined in mtl-2.3.1 · Control.Monad.Select'Readerizes' the writer: the 'ranking' function can see the value that's been accumulated (of type
w), but can't add anything to the log. Effectively, can be thought of as 'extending' the 'ranking' by all values ofw, but whichwgets given to any rank calls is predetermined by the 'outer writer' (and cannot change).(MonadTrans t, MonadSelect r m, Monad (t m)) => MonadSelect r (LiftingSelect t m)Defined in mtl-2.3.1 · Control.Monad.SelectMonadSelect r' m => MonadSelect r' (ContT r m)Defined in mtl-2.3.1 · Control.Monad.SelectThe continuation describes a way of choosing a 'search' or 'ranking' strategy for
r, based on a 'ranking' usingr', given anya. We then get a 'search' strategy forr.MonadSelect w' m => MonadSelect w' (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.SelectA combination of an 'outer' ReaderT,
WriterTandStateT. In short, you get a value of typerwhich can influence what gets picked, but not how anything is ranked, and the 'ranking' function gets access to ansand aw, but can modify neither.(MonadSelect w' m, Monoid w) => MonadSelect w' (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.SelectA combination of an 'outer' ReaderT,
WriterTandStateT. In short, you get a value of typerwhich can influence what gets picked, but not how anything is ranked, and the 'ranking' function gets access to ansand aw, but can modify neither.(MonadSelect w' m, Monoid w) => MonadSelect w' (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.SelectA combination of an 'outer' ReaderT,
WriterTandStateT. In short, you get a value of typerwhich can influence what gets picked, but not how anything is ranked, and the 'ranking' function gets access to ansand aw, but can modify neither.