Defining an infix operator `!` is recognised as a bang pattern
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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