Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7776 closed bug (fixed)

Can't make operator called ~#

Reported by: adrianmay Owned by:
Priority: normal Milestone:
Component: Compiler (Parser) Version: 7.6.1
Keywords: tilde hash sharp operator Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: GHC rejects valid program Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


In response to:

infixl 8 ~#

GHC says:

parse error on input `~#'


infixl 8 ~$ infixl 8 !#

are both fine.

Hugs version September 2006 accepts ~#

GHC seems to barf over ~# in any context.

(The reason I have this version of GHC is that it comes with the Haskell Platform Ubuntu package right now.)

Change History (4)

comment:1 Changed 5 years ago by isaacdupree

Component: CompilerCompiler (Parser)

Fascinating! GHC 7.6.1 also dislikes ~# . I tried operators by typing ( ~# ) in GHCi.

comment:2 Changed 5 years ago by ian@…

commit 01efdd6c4b066fbfdf17c6d2b1cad0fd651d334a

Author: Ian Lynagh <>
Date:   Mon Mar 18 10:12:57 2013 +0000

    Only steal ~# as a reserved operator when MagicHash is enabled; fixes #7776

 compiler/parser/Lexer.x |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

comment:3 Changed 5 years ago by igloo

difficulty: Unknown
Resolution: fixed
Status: newclosed

Thanks for the report; fixed.

comment:4 Changed 5 years ago by goldfire

I would argue that ~# should never be user-visible syntax, as there is no use case for it. In source Haskell, ~# is a type constructor of kind k -> k -> # but this type has no values. This certainly isn't blocking anything, but I was quite surprised that ~# was available at all in source Haskell.

For those of you unfamiliar with ~#, that's the type constructor for GHC's internal notion of type equality --- it's an unlifted form of ~.

Note: See TracTickets for help on using tickets.