haskell / haskell/error-messages
Suggest -XMagicHash where appropriate
- Dominant language
- No language data
- Stars
- 76
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
Consider using a primitive such as `spark#`. Without `-XMagicHash`, on GHC 9.2.1, I get the following error:
```
src/Rtq/Internal.hs:172:31: error:
Variable not in scope:
(#) :: t0 -> t1 -> (# GHC.Prim.State# GHC.Prim.RealWorld, a #)
|
172 | par x = Par $ IO $ \s -> spark# x s
|
```
In almost every case when a haskell developer is writing the hash character (`#`), they mean to invoke the use of a primitive, or some identifier which is donning a hash to signal its involvement with unboxed things or primitives (e.g. I have implemented `compareByteArray# :: ByteArray# -> ByteArray# -> Int#`). There are some instances for which this is not the case, such as `(#)` in profunctors, but I can't see why it would hurt to say "Perhaps you intended to enable MagicHash?". I also think this is another case where allowing operators without spaces is suboptimal from a UX perspective (e.g. IMO using `(.)` without spaces is poor form), but disallowing that is not what I hope to accomplish from posting here, improving the error message is.
Thanks
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.