in-other-words-0.1.1.0: A higher-order effect system where the sky's the limit
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Alt

Synopsis

Effects

data Alt (m :: * -> *) a where Source #

An effect corresponding to the Alternative type class.

Effly's Alternative instance is based on this effect; by having access to Alt, you're able to use <|> and empty inside of effect handlers.

Each Alt interpreter's associated carrier has an Alternative instance based on how it interprets Alt. This means you can use an Alt interpreter to locally gain access to an Alternative instance inside of application code.

Constructors

Empty :: Alt m a 
Alt :: m a -> m a -> Alt m a 

class Applicative f => Alternative (f :: Type -> Type) where #

A monoid on applicative functors.

If defined, some and many should be the least solutions of the equations:

Minimal complete definition

empty, (<|>)

Methods

empty :: f a #

The identity of <|>

(<|>) :: f a -> f a -> f a infixl 3 #

An associative binary operation

some :: f a -> f [a] #

One or more.

many :: f a -> f [a] #

Zero or more.

Instances

Instances details
Alternative []

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

empty :: [a] #

(<|>) :: [a] -> [a] -> [a] #

some :: [a] -> [[a]] #

many :: [a] -> [[a]] #

Alternative Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

empty :: Maybe a #

(<|>) :: Maybe a -> Maybe a -> Maybe a #

some :: Maybe a -> Maybe [a] #

many :: Maybe a -> Maybe [a] #

Alternative IO

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

empty :: IO a #

(<|>) :: IO a -> IO a -> IO a #

some :: IO a -> IO [a] #

many :: IO a -> IO [a] #

Alternative Concurrently 
Instance details

Defined in Control.Concurrent.Async

Alternative Option

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

empty :: Option a #

(<|>) :: Option a -> Option a -> Option a #

some :: Option a -> Option [a] #

many :: Option a -> Option [a] #

Alternative ZipList

Since: base-4.11.0.0

Instance details

Defined in Control.Applicative

Methods

empty :: ZipList a #

(<|>) :: ZipList a -> ZipList a -> ZipList a #

some :: ZipList a -> ZipList [a] #

many :: ZipList a -> ZipList [a] #

Alternative STM

Since: base-4.8.0.0

Instance details

Defined in GHC.Conc.Sync

Methods

empty :: STM a #

(<|>) :: STM a -> STM a -> STM a #

some :: STM a -> STM [a] #

many :: STM a -> STM [a] #

Alternative ReadP

Since: base-4.6.0.0

Instance details

Defined in Text.ParserCombinators.ReadP

Methods

empty :: ReadP a #

(<|>) :: ReadP a -> ReadP a -> ReadP a #

some :: ReadP a -> ReadP [a] #

many :: ReadP a -> ReadP [a] #

Alternative Seq

Since: containers-0.5.4

Instance details

Defined in Data.Sequence.Internal

Methods

empty :: Seq a #

(<|>) :: Seq a -> Seq a -> Seq a #

some :: Seq a -> Seq [a] #

many :: Seq a -> Seq [a] #

Alternative P

Since: base-4.5.0.0

Instance details

Defined in Text.ParserCombinators.ReadP

Methods

empty :: P a #

(<|>) :: P a -> P a -> P a #

some :: P a -> P [a] #

many :: P a -> P [a] #

Alternative (U1 :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: U1 a #

(<|>) :: U1 a -> U1 a -> U1 a #

some :: U1 a -> U1 [a] #

many :: U1 a -> U1 [a] #

MonadPlus m => Alternative (WrappedMonad m)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

empty :: WrappedMonad m a #

(<|>) :: WrappedMonad m a -> WrappedMonad m a -> WrappedMonad m a #

some :: WrappedMonad m a -> WrappedMonad m [a] #

many :: WrappedMonad m a -> WrappedMonad m [a] #

ArrowPlus a => Alternative (ArrowMonad a)

Since: base-4.6.0.0

Instance details

Defined in Control.Arrow

Methods

empty :: ArrowMonad a a0 #

(<|>) :: ArrowMonad a a0 -> ArrowMonad a a0 -> ArrowMonad a a0 #

some :: ArrowMonad a a0 -> ArrowMonad a [a0] #

many :: ArrowMonad a a0 -> ArrowMonad a [a0] #

Alternative (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Proxy

Methods

empty :: Proxy a #

(<|>) :: Proxy a -> Proxy a -> Proxy a #

some :: Proxy a -> Proxy [a] #

many :: Proxy a -> Proxy [a] #

(Functor m, Monad m) => Alternative (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

empty :: MaybeT m a #

(<|>) :: MaybeT m a -> MaybeT m a -> MaybeT m a #

some :: MaybeT m a -> MaybeT m [a] #

many :: MaybeT m a -> MaybeT m [a] #

Applicative m => Alternative (ListT m) 
Instance details

Defined in Control.Monad.Trans.List

Methods

empty :: ListT m a #

(<|>) :: ListT m a -> ListT m a -> ListT m a #

some :: ListT m a -> ListT m [a] #

many :: ListT m a -> ListT m [a] #

Alternative m => Alternative (InterpretFailSimpleC m) Source # 
Instance details

Defined in Control.Effect.Fail

(Monad m, Carrier (InterpretSimpleC Alt m)) => Alternative (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Alternative f => Alternative (Rec1 f)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: Rec1 f a #

(<|>) :: Rec1 f a -> Rec1 f a -> Rec1 f a #

some :: Rec1 f a -> Rec1 f [a] #

many :: Rec1 f a -> Rec1 f [a] #

(ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

empty :: WrappedArrow a b a0 #

(<|>) :: WrappedArrow a b a0 -> WrappedArrow a b a0 -> WrappedArrow a b a0 #

some :: WrappedArrow a b a0 -> WrappedArrow a b [a0] #

many :: WrappedArrow a b a0 -> WrappedArrow a b [a0] #

Alternative m => Alternative (Kleisli m a)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

Methods

empty :: Kleisli m a a0 #

(<|>) :: Kleisli m a a0 -> Kleisli m a a0 -> Kleisli m a a0 #

some :: Kleisli m a a0 -> Kleisli m a [a0] #

many :: Kleisli m a a0 -> Kleisli m a [a0] #

Alternative f => Alternative (Ap f)

Since: base-4.12.0.0

Instance details

Defined in Data.Monoid

Methods

empty :: Ap f a #

(<|>) :: Ap f a -> Ap f a -> Ap f a #

some :: Ap f a -> Ap f [a] #

many :: Ap f a -> Ap f [a] #

Alternative f => Alternative (Alt f)

Since: base-4.8.0.0

Instance details

Defined in Data.Semigroup.Internal

Methods

empty :: Alt f a #

(<|>) :: Alt f a -> Alt f a -> Alt f a #

some :: Alt f a -> Alt f [a] #

many :: Alt f a -> Alt f [a] #

(Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

empty :: ExceptT e m a #

(<|>) :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

some :: ExceptT e m a -> ExceptT e m [a] #

many :: ExceptT e m a -> ExceptT e m [a] #

(Monoid w, Alternative m) => Alternative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

empty :: WriterT w m a #

(<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a #

some :: WriterT w m a -> WriterT w m [a] #

many :: WriterT w m a -> WriterT w m [a] #

(Functor m, MonadPlus m) => Alternative (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

empty :: StateT s m a #

(<|>) :: StateT s m a -> StateT s m a -> StateT s m a #

some :: StateT s m a -> StateT s m [a] #

many :: StateT s m a -> StateT s m [a] #

Alternative m => Alternative (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

empty :: ReaderT r m a #

(<|>) :: ReaderT r m a -> ReaderT r m a -> ReaderT r m a #

some :: ReaderT r m a -> ReaderT r m [a] #

many :: ReaderT r m a -> ReaderT r m [a] #

(Functor m, Monad m, Error e) => Alternative (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

empty :: ErrorT e m a #

(<|>) :: ErrorT e m a -> ErrorT e m a -> ErrorT e m a #

some :: ErrorT e m a -> ErrorT e m [a] #

many :: ErrorT e m a -> ErrorT e m [a] #

Alternative m => Alternative (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

empty :: IdentityT m a #

(<|>) :: IdentityT m a -> IdentityT m a -> IdentityT m a #

some :: IdentityT m a -> IdentityT m [a] #

many :: IdentityT m a -> IdentityT m [a] #

(Functor m, MonadPlus m) => Alternative (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

empty :: StateT s m a #

(<|>) :: StateT s m a -> StateT s m a -> StateT s m a #

some :: StateT s m a -> StateT s m [a] #

many :: StateT s m a -> StateT s m [a] #

(Monoid w, Alternative m) => Alternative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

empty :: WriterT w m a #

(<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a #

some :: WriterT w m a -> WriterT w m [a] #

many :: WriterT w m a -> WriterT w m [a] #

(Monoid w, Functor m, MonadPlus m) => Alternative (AccumT w m) 
Instance details

Defined in Control.Monad.Trans.Accum

Methods

empty :: AccumT w m a #

(<|>) :: AccumT w m a -> AccumT w m a -> AccumT w m a #

some :: AccumT w m a -> AccumT w m [a] #

many :: AccumT w m a -> AccumT w m [a] #

(Functor m, MonadPlus m) => Alternative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.CPS

Methods

empty :: WriterT w m a #

(<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a #

some :: WriterT w m a -> WriterT w m [a] #

many :: WriterT w m a -> WriterT w m [a] #

(Functor m, MonadPlus m) => Alternative (SelectT r m) 
Instance details

Defined in Control.Monad.Trans.Select

Methods

empty :: SelectT r m a #

(<|>) :: SelectT r m a -> SelectT r m a -> SelectT r m a #

some :: SelectT r m a -> SelectT r m [a] #

many :: SelectT r m a -> SelectT r m [a] #

Alternative (CompositionBaseT ts m) => Alternative (CompositionC ts m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Compose

Methods

empty :: CompositionC ts m a #

(<|>) :: CompositionC ts m a -> CompositionC ts m a -> CompositionC ts m a #

some :: CompositionC ts m a -> CompositionC ts m [a] #

many :: CompositionC ts m a -> CompositionC ts m [a] #

Eff Alt m => Alternative (Effly m) Source # 
Instance details

Defined in Control.Effect.Internal.Effly

Methods

empty :: Effly m a #

(<|>) :: Effly m a -> Effly m a -> Effly m a #

some :: Effly m a -> Effly m [a] #

many :: Effly m a -> Effly m [a] #

Alternative m => Alternative (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Alternative m => Alternative (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Alternative m => Alternative (EmbedC m) Source # 
Instance details

Defined in Control.Effect.Embed

Methods

empty :: EmbedC m a #

(<|>) :: EmbedC m a -> EmbedC m a -> EmbedC m a #

some :: EmbedC m a -> EmbedC m [a] #

many :: EmbedC m a -> EmbedC m [a] #

Alternative m => Alternative (RunMC m) Source # 
Instance details

Defined in Control.Effect.Embed

Methods

empty :: RunMC m a #

(<|>) :: RunMC m a -> RunMC m a -> RunMC m a #

some :: RunMC m a -> RunMC m [a] #

many :: RunMC m a -> RunMC m [a] #

(Monoid o, Alternative m) => Alternative (WriterLazyC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

empty :: WriterLazyC o m a #

(<|>) :: WriterLazyC o m a -> WriterLazyC o m a -> WriterLazyC o m a #

some :: WriterLazyC o m a -> WriterLazyC o m [a] #

many :: WriterLazyC o m a -> WriterLazyC o m [a] #

(Monoid o, Alternative m) => Alternative (ListenLazyC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

empty :: ListenLazyC o m a #

(<|>) :: ListenLazyC o m a -> ListenLazyC o m a -> ListenLazyC o m a #

some :: ListenLazyC o m a -> ListenLazyC o m [a] #

many :: ListenLazyC o m a -> ListenLazyC o m [a] #

(Monoid o, Alternative m) => Alternative (TellLazyC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

empty :: TellLazyC o m a #

(<|>) :: TellLazyC o m a -> TellLazyC o m a -> TellLazyC o m a #

some :: TellLazyC o m a -> TellLazyC o m [a] #

many :: TellLazyC o m a -> TellLazyC o m [a] #

MonadPlus m => Alternative (WriterC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

empty :: WriterC o m a #

(<|>) :: WriterC o m a -> WriterC o m a -> WriterC o m a #

some :: WriterC o m a -> WriterC o m [a] #

many :: WriterC o m a -> WriterC o m [a] #

MonadPlus m => Alternative (ListenC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

empty :: ListenC o m a #

(<|>) :: ListenC o m a -> ListenC o m a -> ListenC o m a #

some :: ListenC o m a -> ListenC o m [a] #

many :: ListenC o m a -> ListenC o m [a] #

MonadPlus m => Alternative (TellC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

empty :: TellC o m a #

(<|>) :: TellC o m a -> TellC o m a -> TellC o m a #

some :: TellC o m a -> TellC o m [a] #

many :: TellC o m a -> TellC o m [a] #

Alternative m => Alternative (UnliftC m) Source # 
Instance details

Defined in Control.Effect.Internal.Unlift

Methods

empty :: UnliftC m a #

(<|>) :: UnliftC m a -> UnliftC m a -> UnliftC m a #

some :: UnliftC m a -> UnliftC m [a] #

many :: UnliftC m a -> UnliftC m [a] #

MonadPlus m => Alternative (StateLazyC s m) Source # 
Instance details

Defined in Control.Effect.Internal.State

Methods

empty :: StateLazyC s m a #

(<|>) :: StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a #

some :: StateLazyC s m a -> StateLazyC s m [a] #

many :: StateLazyC s m a -> StateLazyC s m [a] #

MonadPlus m => Alternative (StateC s m) Source # 
Instance details

Defined in Control.Effect.Internal.State

Methods

empty :: StateC s m a #

(<|>) :: StateC s m a -> StateC s m a -> StateC s m a #

some :: StateC s m a -> StateC s m [a] #

many :: StateC s m a -> StateC s m [a] #

Alternative m => Alternative (HoistC m) Source # 
Instance details

Defined in Control.Effect.Internal.Regional

Methods

empty :: HoistC m a #

(<|>) :: HoistC m a -> HoistC m a -> HoistC m a #

some :: HoistC m a -> HoistC m [a] #

many :: HoistC m a -> HoistC m [a] #

Alternative m => Alternative (ReaderC i m) Source # 
Instance details

Defined in Control.Effect.Internal.Reader

Methods

empty :: ReaderC i m a #

(<|>) :: ReaderC i m a -> ReaderC i m a -> ReaderC i m a #

some :: ReaderC i m a -> ReaderC i m [a] #

many :: ReaderC i m a -> ReaderC i m [a] #

Alternative m => Alternative (HoistOptionC m) Source # 
Instance details

Defined in Control.Effect.Internal.Optional

Methods

empty :: HoistOptionC m a #

(<|>) :: HoistOptionC m a -> HoistOptionC m a -> HoistOptionC m a #

some :: HoistOptionC m a -> HoistOptionC m [a] #

many :: HoistOptionC m a -> HoistOptionC m [a] #

Alternative m => Alternative (UnwrapTopC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Newtype

Methods

empty :: UnwrapTopC e m a #

(<|>) :: UnwrapTopC e m a -> UnwrapTopC e m a -> UnwrapTopC e m a #

some :: UnwrapTopC e m a -> UnwrapTopC e m [a] #

many :: UnwrapTopC e m a -> UnwrapTopC e m [a] #

Alternative m => Alternative (UnwrapC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Newtype

Methods

empty :: UnwrapC e m a #

(<|>) :: UnwrapC e m a -> UnwrapC e m a -> UnwrapC e m a #

some :: UnwrapC e m a -> UnwrapC e m [a] #

many :: UnwrapC e m a -> UnwrapC e m [a] #

(Monad m, Monoid e) => Alternative (ErrorC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Error

Methods

empty :: ErrorC e m a #

(<|>) :: ErrorC e m a -> ErrorC e m a -> ErrorC e m a #

some :: ErrorC e m a -> ErrorC e m [a] #

many :: ErrorC e m a -> ErrorC e m [a] #

(Monad m, Monoid e) => Alternative (ThrowC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Error

Methods

empty :: ThrowC e m a #

(<|>) :: ThrowC e m a -> ThrowC e m a -> ThrowC e m a #

some :: ThrowC e m a -> ThrowC e m [a] #

many :: ThrowC e m a -> ThrowC e m [a] #

Alternative m => Alternative (BaseControlC m) Source # 
Instance details

Defined in Control.Effect.Internal.BaseControl

Methods

empty :: BaseControlC m a #

(<|>) :: BaseControlC m a -> BaseControlC m a -> BaseControlC m a #

some :: BaseControlC m a -> BaseControlC m [a] #

many :: BaseControlC m a -> BaseControlC m [a] #

Eff Conc m => Alternative (Concurrently m) Source # 
Instance details

Defined in Control.Effect.Conc

Methods

empty :: Concurrently m a #

(<|>) :: Concurrently m a -> Concurrently m a -> Concurrently m a #

some :: Concurrently m a -> Concurrently m [a] #

many :: Concurrently m a -> Concurrently m [a] #

Alternative m => Alternative (InterceptRC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Intercept

Methods

empty :: InterceptRC e m a #

(<|>) :: InterceptRC e m a -> InterceptRC e m a -> InterceptRC e m a #

some :: InterceptRC e m a -> InterceptRC e m [a] #

many :: InterceptRC e m a -> InterceptRC e m [a] #

Alternative m => Alternative (InterpretFailC h m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

empty :: InterpretFailC h m a #

(<|>) :: InterpretFailC h m a -> InterpretFailC h m a -> InterpretFailC h m a #

some :: InterpretFailC h m a -> InterpretFailC h m [a] #

many :: InterpretFailC h m a -> InterpretFailC h m [a] #

Handler h Alt m => Alternative (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

empty :: InterpretAltC h m a #

(<|>) :: InterpretAltC h m a -> InterpretAltC h m a -> InterpretAltC h m a #

some :: InterpretAltC h m a -> InterpretAltC h m [a] #

many :: InterpretAltC h m a -> InterpretAltC h m [a] #

(Alternative f, Alternative g) => Alternative (f :*: g)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: (f :*: g) a #

(<|>) :: (f :*: g) a -> (f :*: g) a -> (f :*: g) a #

some :: (f :*: g) a -> (f :*: g) [a] #

many :: (f :*: g) a -> (f :*: g) [a] #

(Alternative f, Alternative g) => Alternative (Product f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Product

Methods

empty :: Product f g a #

(<|>) :: Product f g a -> Product f g a -> Product f g a #

some :: Product f g a -> Product f g [a] #

many :: Product f g a -> Product f g [a] #

Alternative m => Alternative (SubsumeC e m) Source # 
Instance details

Defined in Control.Effect.Internal

Methods

empty :: SubsumeC e m a #

(<|>) :: SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a #

some :: SubsumeC e m a -> SubsumeC e m [a] #

many :: SubsumeC e m a -> SubsumeC e m [a] #

Alternative m => Alternative (IntroC top new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Intro

Methods

empty :: IntroC top new m a #

(<|>) :: IntroC top new m a -> IntroC top new m a -> IntroC top new m a #

some :: IntroC top new m a -> IntroC top new m [a] #

many :: IntroC top new m a -> IntroC top new m [a] #

Alternative m => Alternative (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

empty :: ReinterpretSimpleC e new m a #

(<|>) :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m a #

some :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m [a] #

many :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m [a] #

Alternative m => Alternative (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

empty :: InterpretC h e m a #

(<|>) :: InterpretC h e m a -> InterpretC h e m a -> InterpretC h e m a #

some :: InterpretC h e m a -> InterpretC h e m [a] #

many :: InterpretC h e m a -> InterpretC h e m [a] #

Alternative m => Alternative (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

empty :: InterpretPrimC s e m a #

(<|>) :: InterpretPrimC s e m a -> InterpretPrimC s e m a -> InterpretPrimC s e m a #

some :: InterpretPrimC s e m a -> InterpretPrimC s e m [a] #

many :: InterpretPrimC s e m a -> InterpretPrimC s e m [a] #

Alternative m => Alternative (UnionC l m) Source # 
Instance details

Defined in Control.Effect.Union

Methods

empty :: UnionC l m a #

(<|>) :: UnionC l m a -> UnionC l m a -> UnionC l m a #

some :: UnionC l m a -> UnionC l m [a] #

many :: UnionC l m a -> UnionC l m [a] #

Alternative m => Alternative (WrapC e e' m) Source # 
Instance details

Defined in Control.Effect.Internal.Newtype

Methods

empty :: WrapC e e' m a #

(<|>) :: WrapC e e' m a -> WrapC e e' m a -> WrapC e e' m a #

some :: WrapC e e' m a -> WrapC e e' m [a] #

many :: WrapC e e' m a -> WrapC e e' m [a] #

Alternative f => Alternative (M1 i c f)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: M1 i c f a #

(<|>) :: M1 i c f a -> M1 i c f a -> M1 i c f a #

some :: M1 i c f a -> M1 i c f [a] #

many :: M1 i c f a -> M1 i c f [a] #

(Alternative f, Applicative g) => Alternative (f :.: g)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: (f :.: g) a #

(<|>) :: (f :.: g) a -> (f :.: g) a -> (f :.: g) a #

some :: (f :.: g) a -> (f :.: g) [a] #

many :: (f :.: g) a -> (f :.: g) [a] #

(Alternative f, Applicative g) => Alternative (Compose f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

empty :: Compose f g a #

(<|>) :: Compose f g a -> Compose f g a -> Compose f g a #

some :: Compose f g a -> Compose f g [a] #

many :: Compose f g a -> Compose f g [a] #

(Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

empty :: RWST r w s m a #

(<|>) :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a #

some :: RWST r w s m a -> RWST r w s m [a] #

many :: RWST r w s m a -> RWST r w s m [a] #

(Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

empty :: RWST r w s m a #

(<|>) :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a #

some :: RWST r w s m a -> RWST r w s m [a] #

many :: RWST r w s m a -> RWST r w s m [a] #

Alternative (t (u m)) => Alternative (ComposeT t u m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Compose

Methods

empty :: ComposeT t u m a #

(<|>) :: ComposeT t u m a -> ComposeT t u m a -> ComposeT t u m a #

some :: ComposeT t u m a -> ComposeT t u m [a] #

many :: ComposeT t u m a -> ComposeT t u m [a] #

Alternative m => Alternative (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

empty :: ReinterpretC h e new m a #

(<|>) :: ReinterpretC h e new m a -> ReinterpretC h e new m a -> ReinterpretC h e new m a #

some :: ReinterpretC h e new m a -> ReinterpretC h e new m [a] #

many :: ReinterpretC h e new m a -> ReinterpretC h e new m [a] #

Alternative m => Alternative (UnionizeC b m) Source # 
Instance details

Defined in Control.Effect.Union

Methods

empty :: UnionizeC b m a #

(<|>) :: UnionizeC b m a -> UnionizeC b m a -> UnionizeC b m a #

some :: UnionizeC b m a -> UnionizeC b m [a] #

many :: UnionizeC b m a -> UnionizeC b m [a] #

Alternative m => Alternative (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

empty :: ExceptionallyC eff exc m a #

(<|>) :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m a -> ExceptionallyC eff exc m a #

some :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m [a] #

many :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m [a] #

Alternative m => Alternative (GainBaseControlC b z m) Source # 
Instance details

Defined in Control.Effect.BaseControl

Methods

empty :: GainBaseControlC b z m a #

(<|>) :: GainBaseControlC b z m a -> GainBaseControlC b z m a -> GainBaseControlC b z m a #

some :: GainBaseControlC b z m a -> GainBaseControlC b z m [a] #

many :: GainBaseControlC b z m a -> GainBaseControlC b z m [a] #

Interpretations

runAltMaybe :: forall m a p. (Threaders '[ErrorThreads] m p, Carrier m) => AltMaybeC m a -> m (Maybe a) Source #

Run an Alt effect purely, returning Nothing on an unhandled empty.

AltMaybeC has an Alternative instance based on the Alt effect it interprets.

Derivs (AltMaybeC m) = Alt ': Derivs m
Prims  (AltMaybeC m) = Optional ((->) ()) ': Prims m

altToError :: forall e m a. Eff (Error e) m => e -> InterpretAltReifiedC m a -> m a Source #

Transform an Alt effect into Error by describing it in terms of throw and catch, using the provided exception to act as empty.

You can use this in application code to locally get access to an Alternative instance (since InterpretAltReifiedC has an Alternative instance based on the Alt effect this interprets).

For example:

altToError (throw exc) empty = throw exc

altToError has a higher-rank type, as it makes use of InterpretAltReifiedC. This makes altToError very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower altToErrorSimple, which doesn't have a higher-rank type. However, you typically don't want to use altToErrorSimple in application code, since altToErrorSimple emits a ReaderThreads threading constraint (see Threaders).

altToNonDet :: Eff NonDet m => AltToNonDetC m a -> m a Source #

Transform an Alt effect into NonDet by describing it in terms of lose and choose.

You can use this in application code to locally get access to an Alternative instance (since AltToNonDetC has an Alternative instance based on the Alt effect this interprets).

For example:

altToNonDet empty = lose

Simple variants of interpretations

altToErrorSimple :: forall e m a p. (Eff (Error e) m, Threaders '[ReaderThreads] m p) => e -> InterpretAltSimpleC m a -> m a Source #

Transform an Alt in terms of throw and catch, by providing an exception to act as empty.

This is a less performant version of altToError that doesn't have a higher-rank type, making it much easier to use partially applied.

Unlike altToError, you typically don't want to use this in application code, since this emits a ReaderThreads threading constraint (see Threaders).

Threading constraints

class (forall e. Threads (ExceptT e) p) => ErrorThreads p Source #

ErrorThreads accepts the following primitive effects:

Instances

Instances details
(forall e. Threads (ExceptT e) p) => ErrorThreads p Source # 
Instance details

Defined in Control.Effect.Internal.Error

Carriers

type AltMaybeC = CompositionC '[IntroUnderC Alt '[Catch (), Throw ()], InterpretAltC AltToErrorUnitH, ErrorC ()] Source #

newtype InterpretAltC h m a Source #

Like InterpretC specialized to interpret Alt, but has Alternative and MonadPlus instances based on the interpreted Alt.

Constructors

InterpretAltC 

Fields

Instances

Instances details
MonadBase b m => MonadBase b (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

liftBase :: b α -> InterpretAltC h m α #

MonadBaseControl b m => MonadBaseControl b (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Associated Types

type StM (InterpretAltC h m) a #

Methods

liftBaseWith :: (RunInBase (InterpretAltC h m) b -> b a) -> InterpretAltC h m a #

restoreM :: StM (InterpretAltC h m) a -> InterpretAltC h m a #

MonadTrans (InterpretAltC h) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

lift :: Monad m => m a -> InterpretAltC h m a #

MonadTransControl (InterpretAltC h) Source # 
Instance details

Defined in Control.Effect.Alt

Associated Types

type StT (InterpretAltC h) a #

Methods

liftWith :: Monad m => (Run (InterpretAltC h) -> m a) -> InterpretAltC h m a #

restoreT :: Monad m => m (StT (InterpretAltC h) a) -> InterpretAltC h m a #

Monad m => Monad (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

(>>=) :: InterpretAltC h m a -> (a -> InterpretAltC h m b) -> InterpretAltC h m b #

(>>) :: InterpretAltC h m a -> InterpretAltC h m b -> InterpretAltC h m b #

return :: a -> InterpretAltC h m a #

Functor m => Functor (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

fmap :: (a -> b) -> InterpretAltC h m a -> InterpretAltC h m b #

(<$) :: a -> InterpretAltC h m b -> InterpretAltC h m a #

MonadFix m => MonadFix (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

mfix :: (a -> InterpretAltC h m a) -> InterpretAltC h m a #

MonadFail m => MonadFail (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

fail :: String -> InterpretAltC h m a #

Applicative m => Applicative (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

pure :: a -> InterpretAltC h m a #

(<*>) :: InterpretAltC h m (a -> b) -> InterpretAltC h m a -> InterpretAltC h m b #

liftA2 :: (a -> b -> c) -> InterpretAltC h m a -> InterpretAltC h m b -> InterpretAltC h m c #

(*>) :: InterpretAltC h m a -> InterpretAltC h m b -> InterpretAltC h m b #

(<*) :: InterpretAltC h m a -> InterpretAltC h m b -> InterpretAltC h m a #

MonadIO m => MonadIO (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

liftIO :: IO a -> InterpretAltC h m a #

Handler h Alt m => Alternative (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

empty :: InterpretAltC h m a #

(<|>) :: InterpretAltC h m a -> InterpretAltC h m a -> InterpretAltC h m a #

some :: InterpretAltC h m a -> InterpretAltC h m [a] #

many :: InterpretAltC h m a -> InterpretAltC h m [a] #

Handler h Alt m => MonadPlus (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

mzero :: InterpretAltC h m a #

mplus :: InterpretAltC h m a -> InterpretAltC h m a -> InterpretAltC h m a #

MonadThrow m => MonadThrow (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

throwM :: Exception e => e -> InterpretAltC h m a #

MonadCatch m => MonadCatch (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

catch :: Exception e => InterpretAltC h m a -> (e -> InterpretAltC h m a) -> InterpretAltC h m a #

MonadMask m => MonadMask (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

mask :: ((forall a. InterpretAltC h m a -> InterpretAltC h m a) -> InterpretAltC h m b) -> InterpretAltC h m b #

uninterruptibleMask :: ((forall a. InterpretAltC h m a -> InterpretAltC h m a) -> InterpretAltC h m b) -> InterpretAltC h m b #

generalBracket :: InterpretAltC h m a -> (a -> ExitCase b -> InterpretAltC h m c) -> (a -> InterpretAltC h m b) -> InterpretAltC h m (b, c) #

Handler h Alt m => Carrier (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Associated Types

type Derivs (InterpretAltC h m) :: [Effect] Source #

type Prims (InterpretAltC h m) :: [Effect] Source #

type StT (InterpretAltC h) a Source # 
Instance details

Defined in Control.Effect.Alt

type StT (InterpretAltC h) a = StT (InterpretC h Alt) a
type Derivs (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

type Prims (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

type StM (InterpretAltC h m) a Source # 
Instance details

Defined in Control.Effect.Alt

type StM (InterpretAltC h m) a = StM (InterpretC h Alt m) a

type AltToNonDetC = InterpretAltC AltToNonDetH Source #

newtype InterpretAltSimpleC m a Source #

Instances

Instances details
MonadTrans InterpretAltSimpleC Source # 
Instance details

Defined in Control.Effect.Alt

Methods

lift :: Monad m => m a -> InterpretAltSimpleC m a #

MonadBase b m => MonadBase b (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

liftBase :: b α -> InterpretAltSimpleC m α #

MonadBaseControl b m => MonadBaseControl b (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Associated Types

type StM (InterpretAltSimpleC m) a #

Monad m => Monad (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Functor m => Functor (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

fmap :: (a -> b) -> InterpretAltSimpleC m a -> InterpretAltSimpleC m b #

(<$) :: a -> InterpretAltSimpleC m b -> InterpretAltSimpleC m a #

MonadFix m => MonadFix (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

mfix :: (a -> InterpretAltSimpleC m a) -> InterpretAltSimpleC m a #

MonadFail m => MonadFail (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

fail :: String -> InterpretAltSimpleC m a #

Applicative m => Applicative (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

MonadIO m => MonadIO (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

liftIO :: IO a -> InterpretAltSimpleC m a #

(Monad m, Carrier (InterpretSimpleC Alt m)) => Alternative (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

(Monad m, Carrier (InterpretSimpleC Alt m)) => MonadPlus (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

MonadThrow m => MonadThrow (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

throwM :: Exception e => e -> InterpretAltSimpleC m a #

MonadCatch m => MonadCatch (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

MonadMask m => MonadMask (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

(Monad m, Carrier (InterpretSimpleC Alt m)) => Carrier (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

Associated Types

type Derivs (InterpretAltSimpleC m) :: [Effect] Source #

type Prims (InterpretAltSimpleC m) :: [Effect] Source #

type Derivs (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

type Prims (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

type StM (InterpretAltSimpleC m) a Source # 
Instance details

Defined in Control.Effect.Alt