HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Modulefused-effects-1.1.2.7Haskell2010

Control.Carrier.Choose.Church

A carrier for Choose effects (nondeterminism without failure).

Under the hood, it uses a Church-encoded binary tree to avoid the problems associated with a naïve list-based implementation (see "ListT done right").

  • 1 type
  • 2 values

Choose carrier

3 declarations
valuerunChoose :: (m b -> m b -> m b) -> (a -> m b) -> ChooseC m a -> m b
#

Run a Choose effect with continuations respectively interpreting <|> and pure.

runChoose fork leaf (pure a <|> b) = leaf a `fork` runChoose fork leaf b
newtypenewtype ChooseC (m :: Type -> Type) a
#

A carrier for Choose effects based on Ralf Hinze’s design described in Deriving Backtracking Monad Transformers.

Constructors

  • ChooseC (forall b. (m b -> m b -> m b) -> (a -> m b) -> m b)
Instances8MonadTrans, Monad, Functor, MonadFix, MonadFail, Applicative, …
  • MonadTrans ChooseCDefined in fused-effects-1.1.2.7 · Control.Carrier.Choose.Church
  • Monad (ChooseC m)Defined in fused-effects-1.1.2.7 · Control.Carrier.Choose.Church
  • Functor (ChooseC m)Defined in fused-effects-1.1.2.7 · Control.Carrier.Choose.Church
  • MonadFix m => MonadFix (ChooseC m)Defined in fused-effects-1.1.2.7 · Control.Carrier.Choose.Church

    Separate fixpoints are computed for each branch.

  • MonadFail m => MonadFail (ChooseC m)Defined in fused-effects-1.1.2.7 · Control.Carrier.Choose.Church
  • Applicative (ChooseC m)Defined in fused-effects-1.1.2.7 · Control.Carrier.Choose.Church
  • MonadIO m => MonadIO (ChooseC m)Defined in fused-effects-1.1.2.7 · Control.Carrier.Choose.Church
  • Algebra sig m => Algebra (Choose :+: sig) (ChooseC m)Defined in fused-effects-1.1.2.7 · Control.Carrier.Choose.Church

Choose effect

0 declarations