liqwid-plutarch-extra-3.21.1: A collection of Plutarch extras from Liqwid Labs
Safe HaskellSafe-Inferred
LanguageHaskell2010

Plutarch.Extra.Bind

Synopsis

Type class

class PApply f => PBind (f :: (S -> Type) -> S -> Type) where Source #

Gives the capability to bind a Kleisli arrow over f to a value: essentially, the equivalent of Haskell's >>=. Unlike Haskell, we don't require the availability of pure: to recover the equivalent of Haskell's Monad, you want both PApplicative and PBind.

Laws

Since: 3.0.1

Methods

(#>>=) :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory f a, PSubcategory f b) => Term s (f a) -> Term s (a :--> f b) -> Term s (f b) infixl 1 Source #

>>=, but as a function on Terms.

Instances

Instances details
PBind PIdentity Source #

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Identity

Methods

(#>>=) :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory PIdentity a, PSubcategory PIdentity b) => Term s (PIdentity a) -> Term s (a :--> PIdentity b) -> Term s (PIdentity b) Source #

PBind PMaybeData Source #

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Bind

Methods

(#>>=) :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory PMaybeData a, PSubcategory PMaybeData b) => Term s (PMaybeData a) -> Term s (a :--> PMaybeData b) -> Term s (PMaybeData b) Source #

PBind PBuiltinList Source #

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Bind

Methods

(#>>=) :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory PBuiltinList a, PSubcategory PBuiltinList b) => Term s (PBuiltinList a) -> Term s (a :--> PBuiltinList b) -> Term s (PBuiltinList b) Source #

PBind PList Source #

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Bind

Methods

(#>>=) :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory PList a, PSubcategory PList b) => Term s (PList a) -> Term s (a :--> PList b) -> Term s (PList b) Source #

PBind PMaybe Source #

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Bind

Methods

(#>>=) :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory PMaybe a, PSubcategory PMaybe b) => Term s (PMaybe a) -> Term s (a :--> PMaybe b) -> Term s (PMaybe b) Source #

PBind (PState s) Source #

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.State

Methods

(#>>=) :: forall (a :: S -> Type) (b :: S -> Type) (s0 :: S). (PSubcategory (PState s) a, PSubcategory (PState s) b) => Term s0 (PState s a) -> Term s0 (a :--> PState s b) -> Term s0 (PState s b) Source #

PBind (PEither e) Source #

Forwards the first PLeft.

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Bind

Methods

(#>>=) :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory (PEither e) a, PSubcategory (PEither e) b) => Term s (PEither e a) -> Term s (a :--> PEither e b) -> Term s (PEither e b) Source #

(forall (s :: S). Semigroup (Term s a)) => PBind (PPair a) Source #

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Bind

Methods

(#>>=) :: forall (a0 :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory (PPair a) a0, PSubcategory (PPair a) b) => Term s (PPair a a0) -> Term s (a0 :--> PPair a b) -> Term s (PPair a b) Source #

PBind f => PBind (PStar f a) Source #

Strengthening to PBind for f allows dynamic control flow on the basis of the result of a PStar f a, using the same 'view' as the PFunctor instance.

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Star

Methods

(#>>=) :: forall (a0 :: S -> Type) (b :: S -> Type) (s :: S). (PSubcategory (PStar f a) a0, PSubcategory (PStar f a) b) => Term s (PStar f a a0) -> Term s (a0 :--> PStar f a b) -> Term s (PStar f a b) Source #

Functions

pjoin :: forall (a :: S -> Type) (f :: (S -> Type) -> S -> Type) (s :: S). (PBind f, PSubcategory f a, PSubcategory f (f a)) => Term s (f (f a) :--> f a) Source #

'Flattens' two identical PBind layers into one.

Since: 3.0.1