indigo-0.6.0: Convenient imperative eDSL over Lorentz.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Indigo.Lib

Description

Standard library for Indigo.

As opposed to Expr and Language modules, this module contains quite standard things that are not present in vanilla Michelson and are not typically found in imperative high level languages.

Synopsis

Views and Voids

view_ :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View_ arg r, exr :~> r, HasSideEffects, IsNotInView) => (Expr arg -> IndigoM exr) -> viewExpr -> IndigoM () Source #

Indigo version of the view macro. It takes a function from view argument to view result and a View structure that typically comes from a top-level case.

void_ :: forall a b voidExpr exb. (KnownValue a, IsError (VoidResult b), NiceConstant b, voidExpr :~> Void_ a b, exb :~> b) => (Expr a -> IndigoM exb) -> voidExpr -> IndigoM () Source #

Indigo version of the void macro.

project :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View_ arg r, exr :~> r, HasSideEffects, IsNotInView) => viewExpr -> (Expr arg -> IndigoM exr) -> IndigoM () Source #

Flipped version of view_ that is present due to the common appearance of flip view parameter $ instr construction.

Semantically we "project" the given parameter inside the body of the View construction.

projectVoid :: forall a b voidExpr exb. (KnownValue a, IsError (VoidResult b), NiceConstant b, voidExpr :~> Void_ a b, exb :~> b) => voidExpr -> (Expr a -> IndigoM exb) -> IndigoM () Source #

Flipped version of void_ that is present due to the common appearance of flip void_ parameter $ instr construction.

Others

subGt0 :: (ex1 :~> Natural, ex2 :~> Natural) => ex1 -> ex2 -> IndigoM () -> IndigoFunction (Maybe Natural) Source #

If the first value is greater than the second one, it returns their difference. If the values are equal, it returns Nothing. Otherwise it fails using the supplied function.