type operators and colon in GHC

John Leo leo at halfaya.org
Thu Dec 10 15:51:04 UTC 2015

I sent this to haskell-cafe a little while ago but didn't get a response,
so I thought I'd try here.  I'd guess this is a case of the GHC user guide
needing an update, but I'd like an expert opinion.


According to sections 7.4.3 and 7.4.4 of the latest GHC documentation
you can define (7.4.3) an infix type constructor as long as it begins with
a colon, for example
data a :*: b = Foo a b

and furthermore (7.4.4) you can define an infix operator without having to
use a colon if you enable the TypeOperators extension:
data a * b = Foo a b

However if I try the former without using TypeOperators I get this compiler
error in 7.10.2:
    Illegal declaration of a type or class operator ‘:*:’
      Use TypeOperators to declare operators in type and declarations

Using TypeOperators fixes this, but then * without colon also works so I
don't see the point of using colon anymore.

My guess is this was some some kind of historical distinction which is no
longer valid and the documentation needs to be updated.  Is this true, or
am I missing something?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151210/9391fb9d/attachment.html>

More information about the ghc-devs mailing list