serokell / tzbot

Timezone bot for Slack
Mozilla Public License 2.0
7 stars 2 forks source link

[Chore] Avoid `RecordWildCards` #97

Closed dcastro closed 1 year ago

dcastro commented 1 year ago

Description

Problem: Matching with RecordWildCards can be problematic.

  1. It makes it harder to see where identifiers come from. E.g.:

    f x y D{..} = 
      z

    Where does z`` come from? Is it a free variable? Or was it put in scope byD{..}`? It's not clear.

  2. It also makes it hard to see where a variable is used in the definition of a function.

    f x y z = 
      < huge function definition >

    If I want to know where and how x is used, I can just click it and my IDE will highlight all the places where x is used.

    With D{..}, no such luck. I usually have to delete D{..} and then HLS will point me to where all the fields names no longer typecheck.

Solution: Replace usages of RecordWildCards with the recently introduced OverloadedRecordDot or NamedFieldPuns.

Related issue(s)

None

:white_check_mark: Checklist for your Pull Request

Related changes (conditional)

Stylistic guide (mandatory)