morley-1.18.0: Developer tools for the Michelson Language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Michelson.Typed.Haskell.Compatibility

Description

Compatibility of Haskell values representation in Michelson.

Synopsis

Documentation

ligoLayout :: GenericStrategy Source #

Default layout in LIGO.

To be used with customGeneric, see this method for more info.

This is similar to leftBalanced, but

  • fields are sorted alphabetically;
  • always puts as large complete binary subtrees as possible at left.

ligoCombLayout :: GenericStrategy Source #

Comb layout in LIGO ( [@layout:comb] ).

To be used with customGeneric.

Note: to make comb layout work for sum types, make sure that in LIGO all the constructors are preceded by the bar symbol in your type declaration:

type my_type =
  [@layout:comb]
  | Ctor1 of nat  ← bar symbol _must_ be here
  | Ctor2 of int
  ...

Though the situation may change: https://gitlab.com/ligolang/ligo/-/issues/1104.