Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Documentation
class HFunctor c => Package c where Source #
A
is a higher-order functor (Package
) which allows to
(un)pack layered structures of nested functors.HFunctor
(unpack | unpackWith), (pack | packWith)
unpack :: Functor f => c (f :.: g) -> f (c g) Source #
Unpacks the outer layer of a package.
Note that it is almost always better to define unpackWith
instead
and rely on the default implementation of unpack
.
The following should hold:
- Definition
unpack
p ==unpackWith
unComp1
p
unpackWith :: Functor f => (forall a. h a -> f (g a)) -> c h -> f (c g) Source #
Given a way to peel the outer layer, unpacks it.
If
is specified instead, a default definition is available.
The following should hold:unpack
- Definition
unpackWith
f p ==unpack
(hmap
(Comp1
.
f) p)- Compatibility
hmap
f p ==unPar1
(unpackWith
(Par1
.
f) p)
pack :: (Foldable f, Functor f) => f (c g) -> c (f :.: g) Source #
Packs the outer layer into the package.
Note that it is almost always better to define packWith
instead
and rely on the default implementation of pack
.
The following should hold:
packWith :: (Foldable f, Functor f) => (forall a. f (g a) -> h a) -> f (c g) -> c h Source #
Instances
Package (Interpreter a :: (k1 -> Type) -> Type) Source # | |
Defined in ZkFold.Symbolic.Interpreter unpack :: forall f (g :: k10 -> Type). Functor f => Interpreter a (f :.: g) -> f (Interpreter a g) Source # unpackWith :: Functor f => (forall (a0 :: k10). h a0 -> f (g a0)) -> Interpreter a h -> f (Interpreter a g) Source # pack :: forall f (g :: k10 -> Type). (Foldable f, Functor f) => f (Interpreter a g) -> Interpreter a (f :.: g) Source # packWith :: (Foldable f, Functor f) => (forall (a0 :: k10). f (g a0) -> h a0) -> f (Interpreter a g) -> Interpreter a h Source # | |
(Ord (Rep i), Ord a) => Package (ArithmeticCircuit a p i :: (Type -> Type) -> Type) Source # | |
Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.Internal unpack :: forall f (g :: k1 -> Type). Functor f => ArithmeticCircuit a p i (f :.: g) -> f (ArithmeticCircuit a p i g) Source # unpackWith :: Functor f => (forall (a0 :: k1). h a0 -> f (g a0)) -> ArithmeticCircuit a p i h -> f (ArithmeticCircuit a p i g) Source # pack :: forall f (g :: k1 -> Type). (Foldable f, Functor f) => f (ArithmeticCircuit a p i g) -> ArithmeticCircuit a p i (f :.: g) Source # packWith :: (Foldable f, Functor f) => (forall (a0 :: k1). f (g a0) -> h a0) -> f (ArithmeticCircuit a p i g) -> ArithmeticCircuit a p i h Source # |