[GHC] #12020: Error message on use of != should suggest use of /=
GHC
ghc-devs at haskell.org
Fri May 6 23:41:43 UTC 2016
#12020: Error message on use of != should suggest use of /=
-------------------------------------+-------------------------------------
Reporter: mhoermann | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
Replying to [comment:1 nomeata]:
I like it, comments:
Do you have more motivational examples, I have a feeling this would mostly
be used for operators.
Would it appear in `:info (/=)` output? What about `:info (!=)` whether or
not it's defined.
Would it be attached to the definition or definable in a separate module?
Adding a custom error message.
I take it that the first definition was supposed to be `(/=) :: a -> a ->
Bool`:
{{{#!hs
class Eq a where
(==) :: a -> a -> Bool
(/=) :: a -> a -> Bool
{-# MISSPELLINGS (/=) AS (!=) "‘Not equal to’ is (/=), syntactically
emulating the the math symbol ≠" #-}
class Eq a => Bits a where
(.&.) :: a -> a -> a
{-# MISSPELLINGS (.&.) AS (&) "Bitwise and is (.&.)." #-}
(.|.) :: a -> a -> a
{-# MISSPELLINGS (.|.) AS (|) "Bitwise or is (.|.)." #-}
...
shiftL :: a -> Int -> a
{-# MISSPELLINGS shiftL AS (<<) "Left shift" #-}
}}}
`(|)` doesn't parse but oh well
{{{
ghci> 4 != 10
_--_ It looks like you're trying
Ö Ö ,- to code. ‘Not equal to’ is (/=), syntactically
|| | ' emulating the the math symbol ≠. Try writing
|\_|/ ‘4 /= 10’ instead.
\_/
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12020#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list