morley-1.7.1: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Michelson.FailPattern

Description

Typical usages of FAILWITH instruction.

Synopsis

Documentation

data TypicalFailWith Source #

This data type captures typical ways to use FAILWITH instruction. Each constructor corresponds to a usage pattern.

isTypicalFailWith :: Instr inp out -> Maybe TypicalFailWith Source #

Check whether given instruction ends with a typical FAILWITH usage. It does not recursively check instructions that can be passed to other instructions.

The instruction MUST be linearized to the left (see linearizeLeft).

  • IMPORTANT* be careful if you want to rewrite this function. It took GHC about 30 seconds to compile this function previously. The clause isTypicalPreFailWith (Seq x PAIR) = .. is crucial, so please don't move these two case branches in this clause outside of it: either in different patten matching or in case or case clause, I usually experienced a regression for any of these options.

modifyTypicalFailWith :: HasCallStack => (MText -> SomeConstrainedValue ConstantScope') -> Instr inp out -> Instr inp out Source #

If given instruction ends with a typical FAILWITH usage, modify the tag used there using given transformation function. It can return any value, not necessarily a string.

class (Typeable a, ConstantScope a) => ConstantScope' a Source #

We need this class to pass it to SomeConstrainedValue. ConstantScope is needed because we push a value and Typeable is needed for FAILWITH.

Instances

Instances details
(Typeable a, ConstantScope a) => ConstantScope' a Source # 
Instance details

Defined in Michelson.FailPattern