goldfirere / th-desugar

Desugars Template Haskell abstract syntax to a simpler format without changing semantics
BSD 3-Clause "New" or "Revised" License
20 stars 13 forks source link

Add support for namespaces in fixity declarations (introduced in `template-haskell-2.22.0.0`) #203

Closed RyanGlScott closed 7 months ago

RyanGlScott commented 7 months ago

template-haskell-2.22.0.0 (shipped with GHC 9.10.1) includes support for namespaces in fixity declarations:

data Dec
  = ...
  | InfixD Fixity NamespaceSpecifier Name
                                  -- ^ @{ infix 3 data foo }@

-- | A way to specify a namespace to look in when GHC needs to find
--   a name's source
data NamespaceSpecifier
  = NoNamespaceSpecifier   -- ^ Name may be everything; If there are two
                           --   names in different namespaces, then consider both
  | TypeNamespaceSpecifier -- ^ Name should be a type-level entity, such as a
                           --   data type, type alias, type family, type class,
                           --   or type variable
  | DataNamespaceSpecifier -- ^ Name should be a term-level entity, such as a
                           --   function, data constructor, or pattern synonym

(Note that InfixD already existed before, but the NamespaceSpecifier field is new.)

We should update DInfix accordingly.