diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2021-06-01 13:46:39 +0300 |
---|---|---|
committer | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2021-06-10 21:03:57 +0300 |
commit | eb0b3695154cbc1ab92dc2aefeb4452428c15a57 (patch) | |
tree | 4f457743fbdb5b5011c5d52311c3a78b4d6e23ac /compiler/Language/Haskell/Syntax/Extension.hs | |
parent | 3d5cb3352c1e1c20f0d5de427f4edbc765ce06d6 (diff) | |
download | haskell-wip/hs-token-arrow.tar.gz |
HsUniToken and HsToken for HsArrow (#19623)wip/hs-token-arrow
Another step towards a simpler design for exact printing.
Updates the haddock submodule.
Diffstat (limited to 'compiler/Language/Haskell/Syntax/Extension.hs')
-rw-r--r-- | compiler/Language/Haskell/Syntax/Extension.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/Language/Haskell/Syntax/Extension.hs b/compiler/Language/Haskell/Syntax/Extension.hs index 278b8aa99e..8d8eadf135 100644 --- a/compiler/Language/Haskell/Syntax/Extension.hs +++ b/compiler/Language/Haskell/Syntax/Extension.hs @@ -706,3 +706,16 @@ type LHsToken tok p = XRec p (HsToken tok) data HsToken (tok :: Symbol) = HsTok deriving instance KnownSymbol tok => Data (HsToken tok) + +type LHsUniToken tok utok p = XRec p (HsUniToken tok utok) + +-- With UnicodeSyntax, there might be multiple ways to write the same token. +-- For example an arrow could be either "->" or "→". This choice must be +-- recorded in order to exactprint such tokens, +-- so instead of HsToken "->" we introduce HsUniToken "->" "→". +-- +-- See also IsUnicodeSyntax in GHC.Parser.Annotation; we do not use here to +-- avoid a dependency. +data HsUniToken (tok :: Symbol) (utok :: Symbol) = HsNormalTok | HsUnicodeTok + +deriving instance (KnownSymbol tok, KnownSymbol utok) => Data (HsUniToken tok utok) |