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

Lorentz.Referenced

Description

Referenced-by-type versions of some instructions.

They allow to "dip" into stack or copy elements of stack referring them by type. Their use is justified, because in most cases there is only one element of each type of stack, and in cases when this does not hold (e.g. entrypoint with multiple parameters of the same type), it might be a good idea to wrap those types into a newtype or to use primitives from named package.

This module is experimental, i.e. everything here should work but may be removed in favor of better development practices.

Each instruction is followed with usage example.

Synopsis
  • dupT :: forall a st. DupT st a st => st :-> (a ': st)
  • dipT :: forall a inp dinp dout out. DipT inp a inp dinp dout out => (dinp :-> dout) -> inp :-> out
  • dropT :: forall a inp dinp dout out. (DipT inp a inp dinp dout out, dinp ~ (a ': dout)) => inp :-> out

Documentation

dupT :: forall a st. DupT st a st => st :-> (a ': st) Source #

Duplicate an element of stack referring it by type.

If stack contains multiple entries of this type, compile error is raised.

dipT :: forall a inp dinp dout out. DipT inp a inp dinp dout out => (dinp :-> dout) -> inp :-> out Source #

Dip repeatedly until element of the given type is on top of the stack.

If stack contains multiple entries of this type, compile error is raised.

dropT :: forall a inp dinp dout out. (DipT inp a inp dinp dout out, dinp ~ (a ': dout)) => inp :-> out Source #

Remove element with the given type from the stack.