Skip to content

[#576] Avoid unnecessary contract conversions

Description

Problem: some code paths in Cleveland repeatedly convert typed contract to untyped and back.

Solution: in two parts:

  • Fold the zoo of Cleveland's *OriginateData types into a single tagged GADT.
  • Make Cleveland's internal functions polymorphic in the tag.

The rest kind of falls out from the above automatically with minimal effort -- we just don't convert representations midway, and only do that at the very end before handing off to morley/morley-client.

This additionally does a bit of refactoring, as switching to a tagged GADT makes some old code dealing with open types redundant.

Related issue(s)

Resolves #576 (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)

Merge request reports