monadic-bang-0.2.2.1: GHC plugin to desugar ! into do-notation
Safe HaskellSafe-Inferred
LanguageGHC2021

MonadicBang.Internal.Effect.Offer

Synopsis

Documentation

data Offer k v m a where Source #

Offers a number of things that can be yoinked, but only once

Constructors

Yoink :: k -> Offer k v m (Maybe v) 

Instances

Instances details
(Algebra sig m, Ord k) => Algebra ((Offer k v :: (Type -> Type) -> Type -> Type) :+: sig) (OfferC k v m) Source # 
Instance details

Defined in MonadicBang.Internal.Effect.Offer

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (OfferC k v m) -> (Offer k v :+: sig) n a -> ctx () -> OfferC k v m (ctx a) #

yoink :: Has (Offer k v) sig m => k -> m (Maybe v) Source #

newtype OfferC k v m a Source #

Constructors

OfferC 

Fields

Instances

Instances details
(Algebra sig m, Ord k) => Algebra ((Offer k v :: (Type -> Type) -> Type -> Type) :+: sig) (OfferC k v m) Source # 
Instance details

Defined in MonadicBang.Internal.Effect.Offer

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (OfferC k v m) -> (Offer k v :+: sig) n a -> ctx () -> OfferC k v m (ctx a) #

Monad m => Applicative (OfferC k v m) Source # 
Instance details

Defined in MonadicBang.Internal.Effect.Offer

Methods

pure :: a -> OfferC k v m a #

(<*>) :: OfferC k v m (a -> b) -> OfferC k v m a -> OfferC k v m b #

liftA2 :: (a -> b -> c) -> OfferC k v m a -> OfferC k v m b -> OfferC k v m c #

(*>) :: OfferC k v m a -> OfferC k v m b -> OfferC k v m b #

(<*) :: OfferC k v m a -> OfferC k v m b -> OfferC k v m a #

Functor m => Functor (OfferC k v m) Source # 
Instance details

Defined in MonadicBang.Internal.Effect.Offer

Methods

fmap :: (a -> b) -> OfferC k v m a -> OfferC k v m b #

(<$) :: a -> OfferC k v m b -> OfferC k v m a #

Monad m => Monad (OfferC k v m) Source # 
Instance details

Defined in MonadicBang.Internal.Effect.Offer

Methods

(>>=) :: OfferC k v m a -> (a -> OfferC k v m b) -> OfferC k v m b #

(>>) :: OfferC k v m a -> OfferC k v m b -> OfferC k v m b #

return :: a -> OfferC k v m a #

runOffer :: Map k v -> OfferC k v m a -> m (Map k v, a) Source #