ndmitchell / ndmitchell/hlint

Defining an infix operator `!` is recognised as a bang pattern

Open
#808 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
1.6k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

I tried to define an operator called (!) like this:

(!) :: a -> b -> ()
_ ! _ = ()

But hlint gives me a parse error, while GHC accepts the codes just fine:

test.hs:4:1: Error: Parse error
Found:
    (!) :: a -> b -> ()
  > _ ! _ = ()

I think hlint (haskell-src-exts?) thinks ! _ is a bang pattern and thus expects the first _ to be a valid function name, as demonstrated by this code:

(!) :: a -> () -> ()
a ! () = ()

which gives the following hint:

test.hs:4:3: Warning: Redundant bang pattern
Found:
  !()
Perhaps:
  ()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run hlint on a test.hs containing the two operator definitions shown in the issue, and read the relevant parsing behavior in hlint or haskell-src-exts. Done means the valid infix operator definition is accepted without a parse error or an incorrect bang-pattern warning, while genuine bang patterns remain handled correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.