Skip to content

[#920] Add IsLabel instance for EntrypointRef

Description

I wanted to do this for a while, but we stalled on the update to GHC 9.2, so I'm doing it now.

TL;DR: this allows using #epName instead of Call @"EpName", and also def instead of CallDefault (the latter was possible before, but only available in Cleveland; I figured if Lorentz allows overloaded labels, def also should be a thing)

This doesn't work so well with manually-specified labels, though. So f.ex. defining root entrypoint with EpdWithRoot won't work with overloaded labels, unless entrypoint name is uppercased (and IIUC this uppercasing will trickle down into Michelson, which we don't necessarily want)

Possible options:

  • Check for both EpName and epName when resolving entrypoints

    This seems reasonable, as in general, you wouldn't want entrypoints to only differ in letter case. But this will break in some edge cases.

  • Derive lowercased entrypoint names in generics

    Arguably a little more robust approach, just lowercase the first constructor letter on the type level instead of doing that on the value level when building annotations. But this breaks compatibility.

  • Don't bother, just say overloaded labels are for convenience with the default case.

#921 is relevant here.

Related issue(s)

Resolves #920 (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