Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Another implementation of nondeterministic choice effect
- data NdetEff a where
- makeChoiceA0 :: Alternative f => Eff (NdetEff ': r) a -> Eff r (f a)
- makeChoiceA :: Alternative f => Eff (NdetEff ': r) a -> Eff r (f a)
- makeChoiceLst :: Eff (NdetEff ': r) a -> Eff r [a]
- msplit :: Member NdetEff r => Eff r a -> Eff r (Maybe (a, Eff r a))
- ifte :: Member NdetEff r => Eff r a -> (a -> Eff r b) -> Eff r b -> Eff r b
- once :: Member NdetEff r => Eff r a -> Eff r a
Documentation
A different implementation, more directly mapping to MonadPlus interface
makeChoiceA0 :: Alternative f => Eff (NdetEff ': r) a -> Eff r (f a) Source #
An interpreter The following is very simple, but leaks a lot of memory The cause probably is mapping every failure to empty It takes then a lot of timne and space to store those empty
makeChoiceA :: Alternative f => Eff (NdetEff ': r) a -> Eff r (f a) Source #
A different implementation, more involved but faster and taking much less (100 times) less memory. The benefit of the effect framework is that we can have many interpreters.
makeChoiceLst :: Eff (NdetEff ': r) a -> Eff r [a] Source #
Same as makeChoiceA, except it has the type hardcoded. Required for MonadBaseControl instance.