This behavior changed in 7.6 I believe.

It used to be that type operators needed to start with a colon, but that 
restriction was dropped. The documentation is out of date. Ticket #11046 is 
about updating Template Haskell to match the new behavior, but it doesn't 
affect the core story of type operators in (non-Template) Haskell. The core 
story is actually quite simple: all non-reserved symbols are type 
*constructors*, not type *variables*.

I'll post a bug about the documentation, which needs to be fixed, indeed.

Richard

On Dec 10, 2015, at 10:58 AM, John Leo <l...@halfaya.org> wrote:

> Thanks, that's helpful.  Sounds like the situation is even more complicated 
> than I realized.  It will be great if the documentation can be updated once 
> the behavior stabilizes.
> 
> John
> 
> On Thu, Dec 10, 2015 at 7:54 AM, Alexey Vagarenko <vagare...@gmail.com> wrote:
> This ticket might be relevant https://ghc.haskell.org/trac/ghc/ticket/11046
> 
> 2015-12-10 20:51 GMT+05:00 John Leo <l...@halfaya.org>:
> 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
> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/data-type-extensions.html
> 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?
> 
> John
> 
> _______________________________________________
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> 
> 
> 
> _______________________________________________
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to