Skip to content

Redefining (~) yields a baffling error message

Running this code:

{-# LANGUAGE TypeOperators #-}
module Bug where

type (~) = Either

Yields a rather strange error:

$ /opt/ghc/8.4.3/bin/ghci Bug2.hs
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug2.hs, interpreted )

Bug2.hs:4:1: error:
    Cannot redefine a Name retrieved by a Template Haskell quote: ~
  |
4 | type (~) = Either
  | ^^^^^^^^^^^^^^^^^

Since Template Haskell certainly isn't involved here.

The culprit is that (~) isn't listed within isBuiltInOcc_maybe. Patch incoming.

Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information