Syntax changes due to TypeInType
eir at cis.upenn.edu
Wed Mar 16 01:16:46 UTC 2016
The TypeInType patch did relatively little to the abstract syntax. HsImplicitBndrs no longer separates type variables and kind variables. And there was some major surgery to the type/kind parser (discussed below). It's that last bit that you probably want to know about. But check out https://phabricator.haskell.org/rGHC6746549772c5cc0ac66c0fce562f297f4d4b80a2 and you'll see that not much changed.
The "major surgery" to the parser is concerned solely with parsing *. Because the kind * is parsed like an alphanumeric identifier and the type * is parsed like an infix operator, and because types and kinds have to share a parser, we can't use the old HsOpTy story. Instead, we essentially parse a bunch of space-separated tokens in a type as a list, stored in HsAppsTy. Then, in the renamer, once we know which * we're dealing with, we can get rid of HsAppsTy and go on with HsOpTy, etc., as usual. That's really it. There may be improvements possible to this scheme -- I'm far from wedded to it.
The bigger change in the syntax since GHC 7.10 is Simon's wildcard refactor, https://phabricator.haskell.org/rGHC1e041b7382b6aa329e4ad9625439f811e0f27232 The new story is quite well explained in a Note, starting at https://github.com/ghc/ghc/blob/master/compiler/hsSyn/HsTypes.hs#L137
There is also the addition of visible type application, but that's just two new constructor in HsExpr, HsAppType/HsAppTypeOut. I believe it's straightforward.
Are there other particular points giving you challenge?
On Mar 15, 2016, at 5:13 PM, Matthew Pickering <matthewtpickering at gmail.com> wrote:
> I'm trying to update the haskell-src-exts parser for the syntax
> changes in GHC 8 but I'm struggling to find information about what
> exactly the kind equalities patch has changed. Could someone please
> give me a brief overview about what changes were made to the parser?
> I was waiting for the manual entry (D1995) but whilst it is
> illuminating about the semantic changes, the syntactic changes are a
> bit less clear to me.
> A very high-level overview would be helpful so I can then look at the
> diff to find the finer details.
> ghc-devs mailing list
> ghc-devs at haskell.org
More information about the ghc-devs