module Control.Effect.NonDet
(
NonDet
, module Control.Effect.Choose
, module Control.Effect.Empty
, oneOf
, foldMapA
, Alternative(..)
, Algebra
, Effect
, Has
, MonadPlus(..)
, guard
, optional
, run
) where
import Control.Algebra
import Control.Applicative (Alternative(..), optional)
import Control.Effect.Choose (Choose(..))
import Control.Effect.Empty (Empty(..))
import Control.Effect.NonDet.Internal (NonDet)
import Control.Monad (MonadPlus(..), guard)
import Data.Coerce
import Data.Monoid (Alt(..))
oneOf :: (Foldable t, Alternative m) => t a -> m a
oneOf :: t a -> m a
oneOf = (a -> m a) -> t a -> m a
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Alternative m) =>
(a -> m b) -> t a -> m b
foldMapA a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
foldMapA :: (Foldable t, Alternative m) => (a -> m b) -> t a -> m b
foldMapA :: (a -> m b) -> t a -> m b
foldMapA f :: a -> m b
f = Alt m b -> m b
forall k (f :: k -> *) (a :: k). Alt f a -> f a
getAlt (Alt m b -> m b) -> (t a -> Alt m b) -> t a -> m b
forall b c a. Coercible b c => (b -> c) -> (a -> b) -> a -> c
#. (a -> Alt m b) -> t a -> Alt m b
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (m b -> Alt m b
forall k (f :: k -> *) (a :: k). f a -> Alt f a
Alt (m b -> Alt m b) -> (a -> m b) -> a -> Alt m b
forall b c a. Coercible b c => (b -> c) -> (a -> b) -> a -> c
#. a -> m b
f)
(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
#. :: (b -> c) -> (a -> b) -> a -> c
(#.) _ = (a -> b) -> a -> c
forall a b. Coercible a b => a -> b
coerce
{-# INLINE (#.) #-}