heftia-effects-0.4.0.0: higher-order effects done right
Copyright(c) 2024 Sayo Koyoneda
LicenseMPL-2.0 (see the LICENSE file)
Maintainerymdfield@outlook.jp
Portabilityportable
Safe HaskellNone
LanguageGHC2021

Control.Monad.Hefty.NonDet

Description

 
Synopsis

Documentation

runNonDet :: forall f (ef :: [Type -> Type]) a. Alternative f => Eff ('[] :: [EffectH]) (Choose ': (Empty ': ef)) a -> Eff ('[] :: [EffectH]) ef (f a) Source #

NonDet effects handler for alternative answer type.

runNonDetMonoid :: forall ans (ef :: [EffectF]) a. Monoid ans => (a -> Eff ('[] :: [EffectH]) ef ans) -> Eff ('[] :: [EffectH]) (Choose ': (Empty ': ef)) a -> Eff ('[] :: [EffectH]) ef ans Source #

NonDet effects handler for monoidal answer type.

runChoose :: forall f (ef :: [Type -> Type]) a. Alternative f => Eff ('[] :: [EffectH]) (Choose ': ef) a -> Eff ('[] :: [EffectH]) ef (f a) Source #

Choose effect handler for alternative answer type.

runChooseMonoid :: forall ans (ef :: [EffectF]) a. Semigroup ans => (a -> Eff ('[] :: [EffectH]) ef ans) -> Eff ('[] :: [EffectH]) (Choose ': ef) a -> Eff ('[] :: [EffectH]) ef ans Source #

Choose effect handler for monoidal answer type.

runEmpty :: forall a (r :: [Type -> Type]). Eff ('[] :: [EffectH]) (Empty ': r) a -> Eff ('[] :: [EffectH]) r (Maybe a) Source #

Empty effect handler.

runChooseH :: forall (ef :: [EffectF]) (eh :: [(Type -> Type) -> Type -> Type]). Choose <| ef => Eff (ChooseH ': eh) ef ~> Eff eh ef Source #

ChooseH effect elaborator.

Convert a higher-order effect of the form

chooseH :: m a -> m a -> m a

into a first-order effect of the form:

choose :: m Bool

branch :: forall (ef :: [EffectF]) (eh :: [EffectH]) a. Choose <| ef => Eff eh ef a -> Eff eh ef a -> Eff eh ef a Source #

Faster than <|>.