[GHC] #15781: Extraneous parentheses required to parse kind signature on the RHS of a type synonym
GHC
ghc-devs at haskell.org
Fri Oct 19 12:36:25 UTC 2018
#15781: Extraneous parentheses required to parse kind signature on the RHS of a
type synonym
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.8.1
Component: Compiler | Version: 8.7
(Parser) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: GHC rejects
Unknown/Multiple | valid program
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
After Phab:D5173, the restrictions about where kind signatures can appear
in the source were significantly relaxed so that things like:
{{{#!hs
type family F where
F = Int :: Type
}}}
Are now allowed. However, there appears to be one case that was missed in
that patch: the right-hand sides of type synonyms. For instance, I would
expect the following to parse:
{{{#!hs
{-# LANGUAGE KindSignatures #-}
module Bug where
import Data.Kind
type F = Int :: Type
}}}
However, even GHC HEAD still refuses to parse this:
{{{
$ /opt/ghc/head/bin/ghci Bug.hs
GHCi, version 8.7.20181015: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:6:14: error: parse error on input ‘::’
|
6 | type F = Int :: Type
| ^^
}}}
Luckily, I don't think this will be too difficult to fix, since all that
needs to be done is to update the parser production for type synonyms to
use something like `ktype` instead of `ctype`. Patch incoming.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15781>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list