| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Effect.Internal.NonDet
Synopsis
- newtype NonDet m a where
- newtype Cull m a where
- data Cut m a where
- type Logic = Bundle '[NonDet, Cull, Cut, Split]
- type NonDetThreads = Threads ListT
- newtype LogicC m a = LogicC {}
- data CullOrCall
- newtype CullCutC m a = CullCutC {
- unCullCutC :: ListT m a
- newtype NonDetC m a = NonDetC {}
- runNonDet :: forall f m a p. (Alternative f, Carrier m, Threaders '[NonDetThreads] m p) => NonDetC m a -> m (f a)
- runNonDet1 :: forall m a p. (Carrier m, Threaders '[NonDetThreads] m p) => NonDetC m a -> m (Maybe a)
- runCullCut :: forall f m a p. (Alternative f, Carrier m, Threaders '[NonDetThreads] m p) => CullCutC m a -> m (f a)
- runLogic :: forall f m a p. (Alternative f, Carrier m, Threaders '[NonDetThreads] m p) => LogicC m a -> m (f a)
Documentation
An effect to delimit backtracking within nondeterministic contexts.
type NonDetThreads = Threads ListT Source #
NonDetThreads accepts the following primitive effects:
RegionalsOptionals(whensis a functor)UnravelpListenPrims(whensis aMonoid)ListenPrims(whensis aMonoid)ReaderPrimi
Instances
| MonadTrans LogicC Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadBase b m => MonadBase b (LogicC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| Monad (LogicC m) Source # | |
| Functor (LogicC m) Source # | |
| MonadFail m => MonadFail (LogicC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| Applicative (LogicC m) Source # | |
| MonadIO m => MonadIO (LogicC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadThrow m => MonadThrow (LogicC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadCatch m => MonadCatch (LogicC m) Source # | |
| (Carrier m, Threads ListT (Prims m)) => Carrier (LogicC m) Source # | |
| type Derivs (LogicC m) Source # | |
| type Prims (LogicC m) Source # | |
data CullOrCall Source #
Constructors
| CullCutC | |
Fields
| |
Instances
| MonadTrans CullCutC Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadBase b m => MonadBase b (CullCutC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| Monad (CullCutC m) Source # | |
| Functor (CullCutC m) Source # | |
| MonadFail m => MonadFail (CullCutC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| Applicative (CullCutC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadIO m => MonadIO (CullCutC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadThrow m => MonadThrow (CullCutC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadCatch m => MonadCatch (CullCutC m) Source # | |
| (Carrier m, Threads ListT (Prims m)) => Carrier (CullCutC m) Source # | |
| type Derivs (CullCutC m) Source # | |
| type Prims (CullCutC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
Instances
| MonadTrans NonDetC Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadBase b m => MonadBase b (NonDetC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| Monad (NonDetC m) Source # | |
| Functor (NonDetC m) Source # | |
| MonadFail m => MonadFail (NonDetC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| Applicative (NonDetC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadIO m => MonadIO (NonDetC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadThrow m => MonadThrow (NonDetC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
| MonadCatch m => MonadCatch (NonDetC m) Source # | |
| (Carrier m, Threads ListT (Prims m)) => Carrier (NonDetC m) Source # | |
| type Derivs (NonDetC m) Source # | |
| type Prims (NonDetC m) Source # | |
Defined in Control.Effect.Internal.NonDet | |
runNonDet :: forall f m a p. (Alternative f, Carrier m, Threaders '[NonDetThreads] m p) => NonDetC m a -> m (f a) Source #
Runs a NonDet effect.
Unlike runLogic and runCullCut, this doesn't provide any means of interacting
with created branches through Split, Cull or Cut.
However, it also doesn't impose any primitive effects, meaning runNonDet doesn't
restrict what interpreters are run before it.
Derivs(NonDetCm) =NonDet':Derivsm
Prims(NonDetCm) =Primsm
runNonDet1 :: forall m a p. (Carrier m, Threaders '[NonDetThreads] m p) => NonDetC m a -> m (Maybe a) Source #
Runs a NonDet effect, but stop once the first valid result is found.
This is like runNonDet with the Alternative specialized to Maybe,
but once a valid result is found, it won't run all other branches.
This is the equivalent of
or runCullCut @Maybe . cull, but doesn't impose
any primitive effects, meaning runLogic @Maybe . cullrunNonDet1 doesn't restrict what interpreters
are run before it.
Derivs(NonDetCm) =NonDet':Derivsm
Prims(NonDetCm) =Primsm
runCullCut :: forall f m a p. (Alternative f, Carrier m, Threaders '[NonDetThreads] m p) => CullCutC m a -> m (f a) Source #
Runs connected NonDet, Cull, and Cut effects.
Unlike runLogic, this doesn't provide the full power of Split.
This allows for a larger variety of interpreters to be run before
runCullCut compared to runLogic, since Split is significantly harder to
thread compared to Cull and Cut.
Derivs(CullCutCm) =Cull':Cut':NonDet':Derivsm
Prims(CullCutCm) =RegionalCullOrCall ':Primsm
runLogic :: forall f m a p. (Alternative f, Carrier m, Threaders '[NonDetThreads] m p) => LogicC m a -> m (f a) Source #
Runs connected NonDet, Cull, Cut, and Split effects
-- i.e. Logic.
Derivs(LogicCm) =Split':Cull':Cut':NonDet':Derivsm
Prims(LogicCm) =Split':RegionalCullOrCall ':Primsm
Split is a very restrictive primitive effect. Most notably,
interpreters for effects with failure -- such as
runError -- can't be used before runLogic.
If you want to use such interpreters before runLogic,
consider using runCullCut or runNonDet instead.