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

Plutarch.Extra.Traversable

Synopsis

Type classes

class PFunctor t => PTraversable (t :: (S -> Type) -> S -> Type) where Source #

Since: 1.0.0

Methods

ptraverse :: forall (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PApplicative f, PSubcategory f a, PSubcategory f b, PSubcategory f (t b), PSubcategory t a, PSubcategory t b) => Term s ((a :--> f b) :--> (t a :--> f (t b))) Source #

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

This avoids re-building the input PTraversable if we end up throwing it away anyway. In the case where we only care about the effect, and don't need the PTraversable afterwards, this can be more efficient.

Note

This is 'boredom-polymorphic' to ensure that we don't run into issues with PSubcategory constraints. This is why we choose the order of type variables as we do: it allows you to easily choose which PBoring thing you want.

Since: 1.2.0

Instances

Instances details
PTraversable PIdentity Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PTraversable PSum Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

ptraverse :: forall (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PApplicative f, PSubcategory f a, PSubcategory f b, PSubcategory f (PSum b), PSubcategory PSum a, PSubcategory PSum b) => Term s ((a :--> f b) :--> (PSum a :--> f (PSum b))) Source #

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

PTraversable PMaybeData Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PTraversable PBuiltinList Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PTraversable PList Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PTraversable PMaybe Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PTraversable (PConst a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PTraversable (PThese a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.These

Methods

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

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

PTraversable (PEither e) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PTraversable (PPair a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PTraversable (PTagged tag) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Tagged

Methods

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

ptraverse_ :: forall (b :: S -> Type) (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PApplicative f, PSubcategory f b, PBoring b, PSubcategory (PTagged tag) a) => Term s ((a :--> f b) :--> (PTagged tag a :--> f b)) Source #

class PTraversable t => PSemiTraversable (t :: (S -> Type) -> S -> Type) where Source #

Since: 1.0.0

Methods

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

psemitraverse_ :: forall (b :: S -> Type) (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PApply f, PSubcategory f b, PBoring b, PSubcategory t a) => Term s ((a :--> f b) :--> (t a :--> f b)) Source #

Instances

Instances details
PSemiTraversable PIdentity Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PSemiTraversable PSum Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

psemitraverse_ :: forall (b :: S -> Type) (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PApply f, PSubcategory f b, PBoring b, PSubcategory PSum a) => Term s ((a :--> f b) :--> (PSum a :--> f b)) Source #

PSemiTraversable (PPair a) Source #

Since: 1.0.0

Instance details

Defined in Plutarch.Extra.Traversable

Methods

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

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

PSemiTraversable (PTagged tag) Source #

Since: 1.2.0

Instance details

Defined in Plutarch.Extra.Tagged

Methods

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

psemitraverse_ :: forall (b :: S -> Type) (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PApply f, PSubcategory f b, PBoring b, PSubcategory (PTagged tag) a) => Term s ((a :--> f b) :--> (PTagged tag a :--> f b)) Source #

Functions

Folds

psemifold :: forall (t :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PSemiTraversable t, forall (s' :: S). Semigroup (Term s' a), PSubcategory t a) => Term s (t a :--> a) Source #

Collapse a non-empty 'structure' full of a Semigroup.

Since: 1.2.0

psemifoldMap :: forall (t :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PSemiTraversable t, forall (s' :: S). Semigroup (Term s' b), PSubcategory t a) => Term s ((a :--> b) :--> (t a :--> b)) Source #

Collapse a non-empty 'structure' with a projection into a Semigroup.

Since: 1.2.0

psemifoldComonad :: forall (t :: (S -> Type) -> S -> Type) (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PComonad f, PSemiTraversable t, forall (s' :: S). Semigroup (Term s' (f b)), PSubcategory f b, PSubcategory t a) => Term s ((a :--> f b) :--> (t a :--> b)) Source #

Collapse a non-empty 'structure' with a projection into a PComonad. This is the most general semifold possible.

Since: 1.2.0

pfold :: forall (t :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PTraversable t, forall (s' :: S). Monoid (Term s' a), PSubcategory t a) => Term s (t a :--> a) Source #

Collapse a possibly empty 'structure' full of a Monoid.

Since: 1.0.0

pfoldMap :: forall (t :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PTraversable t, forall (s' :: S). Monoid (Term s' b), PSubcategory t a) => Term s ((a :--> b) :--> (t a :--> b)) Source #

Collapse a possibly empty 'structure' with a projection into a Monoid.

Since: 1.0.0

pfoldComonad :: forall (t :: (S -> Type) -> S -> Type) (f :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PComonad f, PTraversable t, forall (s' :: S). Monoid (Term s' (f b)), PSubcategory f b, PSubcategory t a) => Term s ((a :--> f b) :--> (t a :--> b)) Source #

Collapse a possibly empty 'structure' with a projection into a PComonad. This is the most general fold possible.

Since: 1.0.0

Specialized folds

psum :: forall (t :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PTraversable t, PNum a, PSubcategory t a) => Term s (t a :--> a) Source #

'Add up' all the elements in the structure.

Since: 1.0.0

plength :: forall (t :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PTraversable t, PSubcategory t a) => Term s (t a :--> PInteger) Source #

Counts the number of elements in the 'structure'.

Since: 1.0.0

pany :: forall (t :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PTraversable t, PSubcategory t a) => Term s ((a :--> PBool) :--> (t a :--> PBool)) Source #

Since: 1.3.0

pall :: forall (t :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PTraversable t, PSubcategory t a) => Term s ((a :--> PBool) :--> (t a :--> PBool)) Source #

Since: 1.3.0