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

Plutarch.Extra.Applicative

Synopsis

Type classes

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

Since: 1.0.0

Methods

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

Instances

Instances details
PApply PIdentity Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Identity

Methods

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

PApply PSum Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Sum

Methods

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

PApply PMaybeData Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

PApply PBuiltinList Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

PApply PList Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

PApply PMaybe Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

(forall (s :: S). Semigroup (Term s a)) => PApply (PConst a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Const

Methods

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

PApply (PState s) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.State

Methods

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

(PIsData a, forall (s :: S). Semigroup (Term s (PAsData a))) => PApply (PDThese a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.These

Methods

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

(forall (s :: S). Semigroup (Term s a)) => PApply (PThese a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.These

Methods

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

PApply (PEither e) Source #

Forwards the first PLeft.

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

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

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

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

Strengthening to PApply for f allows us to combine together computations in PStar f a using the same 'view' as in the PFunctor instance.

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Star

Methods

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

PApply (PTagged tag) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Tagged

Methods

pliftA2 :: forall (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (PSubcategory (PTagged tag) a, PSubcategory (PTagged tag) b, PSubcategory (PTagged tag) c) => Term s ((a :--> (b :--> c)) :--> (PTagged tag a :--> (PTagged tag b :--> PTagged tag c))) Source #

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

Since: 1.0.0

Methods

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

Instances

Instances details
PApplicative PIdentity Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Identity

Methods

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

PApplicative PSum Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Sum

Methods

ppure :: forall (a :: S -> Type) (s :: S). PSubcategory PSum a => Term s (a :--> PSum a) Source #

PApplicative PMaybeData Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

PApplicative PBuiltinList Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

PApplicative PList Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

PApplicative PMaybe Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

(forall (s :: S). Monoid (Term s a)) => PApplicative (PConst a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Const

Methods

ppure :: forall (a0 :: S -> Type) (s :: S). PSubcategory (PConst a) a0 => Term s (a0 :--> PConst a a0) Source #

PApplicative (PState s) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.State

Methods

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

(forall (s :: S). Semigroup (Term s (PAsData a)), PIsData a) => PApplicative (PDThese a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.These

Methods

ppure :: forall (a0 :: S -> Type) (s :: S). PSubcategory (PDThese a) a0 => Term s (a0 :--> PDThese a a0) Source #

(forall (s :: S). Semigroup (Term s a)) => PApplicative (PThese a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.These

Methods

ppure :: forall (a0 :: S -> Type) (s :: S). PSubcategory (PThese a) a0 => Term s (a0 :--> PThese a a0) Source #

PApplicative (PEither e) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

(forall (s :: S). Monoid (Term s a)) => PApplicative (PPair a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Applicative

Methods

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

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

Strengthening to PApplicative for f allows arbitrary lifts into PStar f a, using the same 'view' as in the PFunctor instance.

Since: 3.0.1

Instance details

Defined in Plutarch.Extra.Star

Methods

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

PApplicative (PTagged tag) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Tagged

Methods

ppure :: forall (a :: S -> Type) (s :: S). PSubcategory (PTagged tag) a => Term s (a :--> PTagged tag a) Source #

class PFunctor f => PAlt f where Source #

Laws:

(a #<!> b) #<!> c = a #<!> (b #<!> c)
f #<$> (a #<!> b) = (f #<$> a) #<!> (f #<$> b)

Since: 3.14.1

Methods

palt :: forall (a :: PType) (s :: S). PSubcategory f a => Term s (f a :--> (f a :--> f a)) Source #

Instances

Instances details
PAlt PMaybeData Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

palt :: forall (a :: PType) (s :: S). PSubcategory PMaybeData a => Term s (PMaybeData a :--> (PMaybeData a :--> PMaybeData a)) Source #

PAlt PBuiltinList Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

palt :: forall (a :: PType) (s :: S). PSubcategory PBuiltinList a => Term s (PBuiltinList a :--> (PBuiltinList a :--> PBuiltinList a)) Source #

PAlt PList Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

palt :: forall (a :: PType) (s :: S). PSubcategory PList a => Term s (PList a :--> (PList a :--> PList a)) Source #

PAlt PMaybe Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

palt :: forall (a :: PType) (s :: S). PSubcategory PMaybe a => Term s (PMaybe a :--> (PMaybe a :--> PMaybe a)) Source #

PAlt (PEither a) Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

palt :: forall (a0 :: PType) (s :: S). PSubcategory (PEither a) a0 => Term s (PEither a a0 :--> (PEither a a0 :--> PEither a a0)) Source #

class (PApplicative f, PAlt f) => PAlternative f where Source #

Laws:

pempty #<!> x = x
x #<!> pempty = x
(a #<!> b) #<*> c = (a #<*> c) #<!> (b #<*> c)

Since: 3.14.1

Methods

pempty :: forall (a :: PType) (s :: S). PSubcategory f a => Term s (f a) Source #

Instances

Instances details
PAlternative PMaybeData Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

pempty :: forall (a :: PType) (s :: S). PSubcategory PMaybeData a => Term s (PMaybeData a) Source #

PAlternative PBuiltinList Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

pempty :: forall (a :: PType) (s :: S). PSubcategory PBuiltinList a => Term s (PBuiltinList a) Source #

PAlternative PList Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

pempty :: forall (a :: PType) (s :: S). PSubcategory PList a => Term s (PList a) Source #

PAlternative PMaybe Source #

Since: 3.14.1

Instance details

Defined in Plutarch.Extra.Applicative

Methods

pempty :: forall (a :: PType) (s :: S). PSubcategory PMaybe a => Term s (PMaybe a) Source #

Functions

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

Since: 1.0.0

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

Since: 1.0.0

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

Since: 1.0.0

(#<!>) :: forall (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PSubcategory f a, PAlt f) => Term s (f a) -> Term s (f a) -> Term s (f a) infixl 3 Source #

Since: 3.14.1

preplicateA :: forall (ell :: (S -> Type) -> S -> Type) (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PApplicative f, PListLike ell, PElemConstraint ell a, PSubcategory f (ell a), PSubcategory f a) => Term s (PInteger :--> (f a :--> f (ell a))) Source #

preplicateA n comp repeats comp n times (0 if n is negative), collects the results into a PListLike, and returns a single computation producing them all.

Notes

The type of the PListLike is left flexible: you can set it using TypeApplications. We put that type parameter first to make this easier.

Since: 1.2.0

preplicateA_ :: forall (f :: (S -> Type) -> S -> Type) (b :: S -> Type) (s :: S). (PApplicative f, PBoring b, PSubcategory f b) => Term s (PInteger :--> (f b :--> f b)) Source #

As preplicateA, but ignores the results.

Since: 1.2.0

pwhen :: forall (f :: (S -> Type) -> S -> Type) (b :: S -> Type) (s :: S). (PApplicative f, PBoring b, PSubcategory f b) => Term s (PBool :--> (f b :--> f b)) Source #

pwhen b comp executes comp if b is PTrue, and does nothing otherwise.

Since: 1.2.0

punless :: forall (f :: (S -> Type) -> S -> Type) (b :: S -> Type) (s :: S). (PApplicative f, PBoring b, PSubcategory f b) => Term s (PBool :--> (f b :--> f b)) Source #

punless b comp executes comp if b is PFalse, and does nothing otherwise.

Since: 1.2.0

ppureIf :: forall (f :: PType -> PType) (a :: PType) (s :: S). (PAlternative f, PSubcategory f a) => Term s (PBool :--> (a :--> f a)) Source #

Return a pure value if a condition is True, otherwise empty.

Since: 3.14.1