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

Lorentz.Constraints.Derivative

Description

Some derivative constraints.

They are moved to separate module because they need to lie quite high in modules dependencies graph (unlike Lorentz.Constraints.Scopes).

Synopsis

Documentation

type NiceParameterFull cp = (Typeable cp, ParameterDeclaresEntrypoints cp) Source #

Constraint applied to a whole parameter type.

data DupableDecision a Source #

Tells whether given type is dupable or not.

Constructors

Dupable a => IsDupable 
IsNotDupable 

decideOnDupable :: forall a. KnownValue a => DupableDecision a Source #

Check whether given value is dupable, returning a proof of that when it is.

This lets defining methods that behave differently depending on whether given value is dupable or not. This may be suitable when for the dupable case you can provide a more efficient implementation, but you also want your implementation to be generic.

Example:

code = case decideOnDupable @a of
  IsDupable -> do dup; ...
  IsNotDupable -> ...