Skip to content
Snippets Groups Projects
  1. Apr 26, 2023
    • Alan Zimmerman's avatar
      EPA: Use ExplicitBraces only in HsModule · 052e2bb6
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      !9018 brought in exact print annotations in LayoutInfo for open and
      close braces at the top level.
      
      But it retained them in the HsModule annotations too.
      
      Remove the originals, so exact printing uses LayoutInfo
      052e2bb6
  2. Dec 23, 2022
  3. Sep 27, 2022
  4. Sep 19, 2022
    • Matthew Farkas-Dyck's avatar
      Scrub partiality about `NewOrData`. · c1f81b38
      Matthew Farkas-Dyck authored and Marge Bot's avatar Marge Bot committed
      Rather than a list of constructors and a `NewOrData` flag, we define `data DataDefnCons a = NewTypeCon a | DataTypeCons [a]`, which enforces a newtype to have exactly one constructor.
      
      Closes #22070.
      
      Bump haddock submodule.
      c1f81b38
  5. Jul 03, 2022
    • Rodrigo Mesquita's avatar
      TTG: Move ImpExp client-independent bits to L.H.S.ImpExp · f9f80995
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Move the GHC-independent definitions from GHC.Hs.ImpExp to
      Language.Haskell.Syntax.ImpExp with the required TTG extension fields
      such as to keep the AST independent from GHC.
      
      This is progress towards having the haskell-syntax package, as described
      in #21592
      
      Bumps haddock submodule
      f9f80995
  6. Apr 08, 2022
  7. Oct 24, 2021
  8. Oct 05, 2021
    • Vladislav Zavialov's avatar
      Bespoke TokenLocation data type · a7629334
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      The EpaAnnCO we were using contained an Anchor instead of EpaLocation,
      making it harder to work with.
      
      At the same time, using EpaLocation by itself isn't possible either,
      as we may have tokens without location information.
      
      Hence the new data type:
      	data TokenLocation = NoTokenLoc
      	                   | TokenLoc !EpaLocation
      a7629334
  9. Jun 17, 2021
  10. May 20, 2021
  11. Apr 19, 2021
    • Alan Zimmerman's avatar
      EPA: cleanups after the merge · 0619fb0f
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      Remove EpaAnn type synonym, rename EpaAnn' to EpaAnn.
      Closes #19705
      
      Updates haddock submodule
      
      --
      
      Change
        data EpaAnchor = AR RealSrcSpan
                       | AD DeltaPos
      
      To instead be
        data EpaAnchor = AnchorReal RealSrcSpan
                       | AnchorDelta DeltaPos
      
      Closes #19699
      
      --
      
      Change
        data DeltaPos =
          DP
            { deltaLine   :: !Int,
              deltaColumn :: !Int
            }
      
      To instead be
        data DeltaPos
          = SameLine { deltaColumn :: !Int }
          | DifferentLine { deltaLine :: !Int, startColumn :: !Int }
      
      Closes #19698
      
      --
      
      Also some clean-ups of unused parts of check-exact.
      0619fb0f
  12. Mar 31, 2021
  13. Mar 20, 2021
  14. Mar 01, 2021
  15. Nov 06, 2020
    • Ryan Scott's avatar
      Replace HsImplicitBndrs with HsOuterTyVarBndrs · e07e383a
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      
      This refactors the GHC AST to remove `HsImplicitBndrs` and replace it with
      `HsOuterTyVarBndrs`, a type which records whether the outermost quantification
      in a type is explicit (i.e., with an outermost, invisible `forall`) or
      implicit. As a result of this refactoring, it is now evident in the AST where
      the `forall`-or-nothing rule applies: it's all the places that use
      `HsOuterTyVarBndrs`. See the revamped `Note [forall-or-nothing rule]` in
      `GHC.Hs.Type` (previously in `GHC.Rename.HsType`).
      
      Moreover, the places where `ScopedTypeVariables` brings lexically scoped type
      variables into scope are a subset of the places that adhere to the
      `forall`-or-nothing rule, so this also makes places that interact with
      `ScopedTypeVariables` easier to find. See the revamped
      `Note [Lexically scoped type variables]` in `GHC.Hs.Type` (previously in
      `GHC.Tc.Gen.Sig`).
      
      `HsOuterTyVarBndrs` are used in type signatures (see `HsOuterSigTyVarBndrs`)
      and type family equations (see `HsOuterFamEqnTyVarBndrs`). The main difference
      between the former and the latter is that the former cares about specificity
      but the latter does not.
      
      There are a number of knock-on consequences:
      
      * There is now a dedicated `HsSigType` type, which is the combination of
        `HsOuterSigTyVarBndrs` and `HsType`. `LHsSigType` is now an alias for an
        `XRec` of `HsSigType`.
      * Working out the details led us to a substantial refactoring of
        the handling of explicit (user-written) and implicit type-variable
        bindings in `GHC.Tc.Gen.HsType`.
      
        Instead of a confusing family of higher order functions, we now
        have a local data type, `SkolemInfo`, that controls how these
        binders are kind-checked.
      
        It remains very fiddly, not fully satisfying. But it's better
        than it was.
      
      Fixes #16762. Bumps the Haddock submodule.
      
      Co-authored-by: default avatarSimon Peyton Jones <simonpj@microsoft.com>
      Co-authored-by: Richard Eisenberg's avatarRichard Eisenberg <rae@richarde.dev>
      Co-authored-by: default avatarZubin Duggal <zubin@cmi.ac.in>
      e07e383a
  16. Oct 30, 2020
    • Ryan Scott's avatar
      Split HsConDecl{H98,GADT}Details · 31fcb55f
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      Haskell98 and GADT constructors both use `HsConDeclDetails`, which includes
      `InfixCon`. But `InfixCon` is never used for GADT constructors, which results
      in an awkward unrepresentable state. This removes the unrepresentable state by:
      
      * Renaming the existing `HsConDeclDetails` synonym to `HsConDeclH98Details`,
        which emphasizes the fact that it is now only used for Haskell98-style data
        constructors, and
      * Creating a new `HsConDeclGADTDetails` data type with `PrefixConGADT` and
        `RecConGADT` constructors that closely resemble `PrefixCon` and `InfixCon`
        in `HsConDeclH98Details`. The key difference is that `HsConDeclGADTDetails`
        lacks any way to represent infix constructors.
      
      The rest of the patch is refactoring to accommodate the new structure of
      `HsConDecl{H98,GADT}Details`. Some highlights:
      
      * The `getConArgs` and `hsConDeclArgTys` functions have been removed, as
        there is no way to implement these functions uniformly for all
        `ConDecl`s. For the most part, their previous call sites now
        pattern match on the `ConDecl`s directly and do different things for
        `ConDeclH98`s and `ConDeclGADT`s.
      
        I did introduce one new function to make the transition easier:
        `getRecConArgs_maybe`, which extracts the arguments from a `RecCon(GADT)`.
        This is still possible since `RecCon(GADT)`s still use the same representation
        in both `HsConDeclH98Details` and `HsConDeclGADTDetails`, and since the
        pattern that `getRecConArgs_maybe` implements is used in several places,
        I thought it worthwhile to factor it out into its own function.
      * Previously, the `con_args` fields in `ConDeclH98` and `ConDeclGADT` were
        both of type `HsConDeclDetails`. Now, the former is of type
        `HsConDeclH98Details`, and the latter is of type `HsConDeclGADTDetails`,
        which are distinct types. As a result, I had to rename the `con_args` field
        in `ConDeclGADT` to `con_g_args` to make it typecheck.
      
        A consequence of all this is that the `con_args` field is now partial, so
        using `con_args` as a top-level field selector is dangerous. (Indeed, Haddock
        was using `con_args` at the top-level, which caused it to crash at runtime
        before I noticed what was wrong!) I decided to add a disclaimer in the 9.2.1
        release notes to advertise this pitfall.
      
      Fixes #18844. Bumps the `haddock` submodule.
      31fcb55f
  17. Oct 20, 2020
    • Alan Zimmerman's avatar
      API Annotations: Keep track of unicode for linear arrow notation · ea736839
      Alan Zimmerman authored
      The linear arrow can be parsed as `%1 ->` or a direct single token unicode
      equivalent.
      
      Make sure that this distinction is captured in the parsed AST by using
      IsUnicodeSyntax where it appears, and introduce a new API Annotation,
      AnnMult to represent its location when unicode is not used.
      
      Updated haddock submodule
      ea736839
  18. Oct 07, 2020
Loading