Skip to content

[#402] Make `RootAnn` == `FieldAnn`

Konstantin Ivanov requested to merge martoon/#402-easier-root-ann into master

Description

Problem: initially RootAnn was an annotation with an unique tag, so it differed from FieldAnn, but I think now it is clear that it was not a helpful idea:

  • There is a LOT of cases when we have to convert between RootAnn and FieldAnn, because we either have to put all annotations together (mkEntrypointsMap) or want to apply a method working with field annotations on a root annotation (epNameFromAnn). connAnn is pretty unsafe and its use should be limited, so using it extensively does not sounds proper.
  • In cases when we could pass RootAnn as-is without conversions, the fact that RootAnn /= FieldAnn wasn't any helpful because we didn't have any field annotations in that scope (at least ones that would be easy to fetch), so this separate RootAnn didn't really decrease the probability of making a bug.

Solution: declare root annotation as type RootAnn = FieldAnn and remove extra coercions.

Related issue(s)

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