Opened 6 years ago

Closed 6 years ago

#8706 closed bug (fixed)

Kind operators not parsed

Reported by: goldfire Owned by:
Priority: normal Milestone: 7.8.1
Component: Documentation Version: 7.8.1-rc1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Take the following module:

{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-}

data a + b = Inl a | Inr b

type family Foo :: Bool + Bool

HEAD produces

/Users/rae/temp/Bug.hs:5:25: parse error on input ‛+’

It seems that type operators promoted to kinds are not parsed correctly.

Change History (7)

comment:1 Changed 6 years ago by goldfire

Component: Compiler (Parser)Documentation

Argh. Of course there can't be kind operators, because it would be impossible to parse them. For example, what does Foo * Bar mean? Is it Foo applied to * and Bar? Or is it * applied to Foo and Bar?

I will document this, but I don't like it.

comment:2 Changed 6 years ago by Richard Eisenberg <eir@…>

In 218dead0d85a136b5d5648e4d6c4c9cc9467eb45/ghc:

Fix #8706, documenting that type operators are not promoted.

comment:3 Changed 6 years ago by goldfire

Status: newmerge

comment:4 Changed 6 years ago by dreixel

Is * the only problem here? If so, can't we promote everything else, and just refuse to promote type constructor operators named *?

comment:5 Changed 6 years ago by goldfire

I do think that would work, but it seems a little unprincipled. And, it was a design decision I wasn't prepared to make without discussion.

My general thought is that we're (in my humble opinion) heading to a future where the kind parser and the type parser are no longer distinct, because types and kinds will no longer be distinct. What does parsing in that world look like? I don't know, but I think we should try to future-proof any decision made here.

comment:6 Changed 6 years ago by goldfire

Milestone: 7.8.1

Putting on Austin's radar for 7.8.1.

comment:7 Changed 6 years ago by thoughtpolice

Resolution: fixed
Status: mergeclosed


Note: See TracTickets for help on using tickets.