Skip to content

[#513] Custom generics for ligo

Konstantin Ivanov requested to merge martoon/#513-custom-generics-ligo into master

Description

Problem: LIGO's default layout applied to product and sum types is currently not supported by us, and whenever we want to keep Lorentz and LIGO contracts on par we have to achieve that manually.

That layout is relatively optimal: the resulting tree is balanced, however e.g. 9 fields will be distributed as 8 fields in left total subtree and 1 field in right subtree; so it's worth trying it and see how this impacts our real contracts.

Solution: adjust our customGenerics to be able to sort fields alphabetically as necessary for LIGO's layout, add support for their way of building tree of pairs/ors.

Add GenericStrategy-ies specifically for LIGO's commonly used layouts.

Related issue(s)

Resolves #513 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Konstantin Ivanov

Merge request reports