Skip to content

[Chore] Forbid (Fmt.+||) and (Fmt.||+)

This is a short follow-up to !978 (merged). I've realized too late we could (probably should) do this, and it didn't feel right to stall !978 (merged) any longer as to not block #753 (closed).

Description

Problem: With !978 (merged) we try rather hard to avoid using Show when printing something. (+||) and (||+) go over our PrettyShow type family and do exactly what we want to avoid.

Solution: Add HLint rules that warn on these.

The less concise, but still very readable alternative to using +|| is something like this:

"a" +| show @Text x |+ "b"

which does check for PrettyShow instance and hence "safe".

Related issue(s)

Follow-up to #623 (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.

N/A

Stylistic guide (mandatory)

Merge request reports