[GHC] #10188: prefix type-level cons can't be parsed

GHC ghc-devs at haskell.org
Tue Mar 24 10:43:27 UTC 2015


#10188: prefix type-level cons can't be parsed
-------------------------------------+-------------------------------------
        Reporter:  Kinokkory         |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.4
  (Parser)                           |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  GHC rejects       |               Test Case:
  valid program                      |                Blocking:
      Blocked By:                    |  Differential Revisions:
 Related Tickets:                    |
-------------------------------------+-------------------------------------
Description changed by Kinokkory:

Old description:

> Whereas other type operators (whether used as type families or used as
> data constructors) can be safely used in a prefix form, only the type-
> level cons of the built-in list kind can't be used in a prefix form.
>
> It really is a problem because we don't have any means to express type-
> level cons itself in source code. This for example prevents us from
> writing a generic type-level foldr that takes the built-in list and other
> similar data types alike.
>
> In a ghci:
>
> {{{#!hs
> > :set -XDataKinds -XTypeOperators
> > data Listy a = a ::: Listy a
> > :kind! (:::)
> (:::) :: k -> Listy k -> Listy k
> = forall (k :: BOX). (':::)
> > :kind! (:)
>
> <interactive>:1:2: parse error on input ‘:’
> }}}

New description:

 Whereas other type operators (whether used as type families or used as
 data constructors) can be safely used in a prefix form, only the type-
 level cons of the built-in list kind can't be used in a prefix form.

 It really is a problem because we don't have any means to express the
 type-level cons itself in source code. This for example prevents us from
 writing a generic type-level foldr that takes the built-in list and other
 similar data types alike.

 In a ghci:

 {{{#!hs
 > :set -XDataKinds -XTypeOperators
 > data Listy a = a ::: Listy a | Nily
 > :kind! (:::)
 (:::) :: k -> Listy k -> Listy k
 = forall (k :: BOX). (':::)
 > :kind! (:)

 <interactive>:1:2: parse error on input ‘:’
 }}}

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10188#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list