lorentz-0.4.0: EDSL for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Lorentz.Zip

Description

Stack zipping.

This module provides functions for flattening stacks into tuples.

Also here we define an instance which turns any instruction, not only lambdas, into a valid value.

Synopsis

Documentation

class KnownIsoT (ZippedStack s) => ZipInstr (s :: [Type]) where Source #

Zipping stack into tuple and back.

Associated Types

type ZippedStack s :: Type Source #

A type which contains the whole stack zipped.

Methods

zipInstr :: s :-> '[ZippedStack s] Source #

Fold given stack into single value.

unzipInstr :: '[ZippedStack s] :-> s Source #

Unfold given stack from a single value.

Instances

Instances details
ZipInstr ('[] :: [Type]) Source # 
Instance details

Defined in Lorentz.Zip

Associated Types

type ZippedStack '[] Source #

Methods

zipInstr :: '[] :-> '[ZippedStack '[]] Source #

unzipInstr :: '[ZippedStack '[]] :-> '[] Source #

ZipInstr ((a, b) ': s) => ZipInstr (a ': (b ': s)) Source #

Such definition seems the only possible one we can support efficiently.

Instance details

Defined in Lorentz.Zip

Associated Types

type ZippedStack (a ': (b ': s)) Source #

Methods

zipInstr :: (a ': (b ': s)) :-> '[ZippedStack (a ': (b ': s))] Source #

unzipInstr :: '[ZippedStack (a ': (b ': s))] :-> (a ': (b ': s)) Source #

KnownIsoT a => ZipInstr '[a] Source # 
Instance details

Defined in Lorentz.Zip

Associated Types

type ZippedStack '[a] Source #

Methods

zipInstr :: '[a] :-> '[ZippedStack '[a]] Source #

unzipInstr :: '[ZippedStack '[a]] :-> '[a] Source #

type ZipInstrs ss = Each '[ZipInstr] ss Source #

Require several stacks to comply ZipInstr constraint.

zippingStack :: ZipInstrs [inp, out] => (inp :-> out) -> Lambda (ZippedStack inp) (ZippedStack out) Source #

Flatten both ends of instruction stack.

unzippingStack :: ZipInstrs [inp, out] => Lambda (ZippedStack inp) (ZippedStack out) -> inp :-> out Source #

Unflatten both ends of instruction stack.

Orphan instances

(WellTypedToT (ZippedStack inp), WellTypedToT (ZippedStack out), ZipInstr inp, ZipInstr out) => IsoValue (inp :-> out) Source # 
Instance details

Associated Types

type ToT (inp :-> out) :: T #

Methods

toVal :: (inp :-> out) -> Value (ToT (inp :-> out)) #

fromVal :: Value (ToT (inp :-> out)) -> inp :-> out #

(HasTypeAnn (ZippedStack i), HasTypeAnn (ZippedStack o)) => HasTypeAnn (i :-> o) Source # 
Instance details

Methods

getTypeAnn :: Notes (ToT (i :-> o)) Source #