Hoogle Search
Within LTS Haskell 24.34 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
subsume :: forall (e :: Effect) (r :: EffectRow) a . Member e r => Sem (e ': r) a -> Sem r apolysemy Polysemy Interprets an effect in terms of another identical effect. This is useful for defining interpreters that use reinterpretH without immediately consuming the newly introduced effect. Using such an interpreter recursively may result in duplicate effects, which may then be eliminated using subsume. For a version that can introduce an arbitrary number of new effects and reorder existing ones, see subsume_.
subsume_ :: forall (r :: EffectRow) (r' :: EffectRow) a . Subsume r r' => Sem r a -> Sem r' apolysemy Polysemy Allows reordering and adding known effects on top of the effect stack, as long as the polymorphic "tail" of new stack is a raise-d version of the original one. This function is highly polymorphic, so it may be a good idea to use its more concrete version (subsume), fitting functions from the raise family or type annotations to avoid vague errors in ambiguous contexts.
-
polysemy Polysemy.Bundle Run a Bundle r if the effect stack contains all effects of r.
class
Subsume (r :: EffectRow) (r' :: EffectRow)polysemy Polysemy.Internal See subsume_.
subsume :: forall (e :: Effect) (r :: EffectRow) a . Member e r => Sem (e ': r) a -> Sem r apolysemy Polysemy.Internal Interprets an effect in terms of another identical effect. This is useful for defining interpreters that use reinterpretH without immediately consuming the newly introduced effect. Using such an interpreter recursively may result in duplicate effects, which may then be eliminated using subsume. For a version that can introduce an arbitrary number of new effects and reorder existing ones, see subsume_.
subsumeUnion :: forall (m :: Type -> Type) a . Subsume r r' => Union r m a -> Union r' m apolysemy Polysemy.Internal No documentation available.
subsumeUsing :: forall (e :: Effect) (r :: [Effect]) a . ElemOf e r -> Sem (e ': r) a -> Sem r apolysemy Polysemy.Internal Interprets an effect in terms of another identical effect, given an explicit proof that the effect exists in r. This is useful in conjunction with tryMembership in order to conditionally make use of effects. For example:
tryListen :: KnownRow r => Sem r a -> Maybe (Sem r ([Int], a)) tryListen m = case tryMembership @(Writer [Int]) of Just pr -> Just $ subsumeUsing pr (listen (raise m)) _ -> Nothing
subsume_ :: forall (r :: EffectRow) (r' :: EffectRow) a . Subsume r r' => Sem r a -> Sem r' apolysemy Polysemy.Internal Allows reordering and adding known effects on top of the effect stack, as long as the polymorphic "tail" of new stack is a raise-d version of the original one. This function is highly polymorphic, so it may be a good idea to use its more concrete version (subsume), fitting functions from the raise family or type annotations to avoid vague errors in ambiguous contexts.
-
polysemy Polysemy.Internal.Bundle Transform a membership proof's stack by arbitrary effects using evidence from the context.
subsumeUsing :: forall (e :: Effect) (r :: [Effect]) a . ElemOf e r -> Sem (e ': r) a -> Sem r apolysemy Polysemy.Membership Interprets an effect in terms of another identical effect, given an explicit proof that the effect exists in r. This is useful in conjunction with tryMembership in order to conditionally make use of effects. For example:
tryListen :: KnownRow r => Sem r a -> Maybe (Sem r ([Int], a)) tryListen m = case tryMembership @(Writer [Int]) of Just pr -> Just $ subsumeUsing pr (listen (raise m)) _ -> Nothing