polysemy-1.5.0.0: Higher-order, low-boilerplate free monads.
Safe HaskellNone
LanguageHaskell2010

Polysemy.NonDet

Synopsis

Effect

data NonDet m a Source #

An effect corresponding to the Alternative typeclass.

Constructors

Empty 
Choose (m a) (m a) 

Interpretations

runNonDet :: Alternative f => Sem (NonDet ': r) a -> Sem r (f a) Source #

Run a NonDet effect in terms of some underlying Alternative f.

runNonDetMaybe :: Sem (NonDet ': r) a -> Sem r (Maybe a) Source #

Run a NonDet effect in terms of an underlying Maybe

Unlike runNonDet, uses of <|> will not execute the second branch at all if the first option succeeds.

Since: 1.1.0.0

nonDetToError :: Member (Error e) r => e -> Sem (NonDet ': r) a -> Sem r a Source #

Transform a NonDet effect into an Error e effect, through providing an exception that empty may be mapped to.

This allows <|> to handle throws of the Error e effect.

Since: 1.1.0.0