Skip to content
Snippets Groups Projects
  1. Jul 03, 2023
  2. Jun 29, 2023
  3. Jun 27, 2023
  4. Jun 21, 2023
    • Bartłomiej Cieślar's avatar
      Add support for deprecating exported items (proposal #134) · 711b1d24
      Bartłomiej Cieślar authored and Ben Gamari's avatar Ben Gamari committed
      
      This is an implementation of the deprecated exports proposal #134.
      The proposal introduces an ability to introduce warnings to exports.
      This allows for deprecating a name only when it is exported from a specific
      module, rather than always depreacting its usage. In this example:
      
          module A ({-# DEPRECATED "do not use" #-} x) where
          x = undefined
          ---
          module B where
          import A(x)
      
      `x` will emit a warning when it is explicitly imported.
      
      Like the declaration warnings, export warnings are first accumulated within
      the `Warnings` struct, then passed into the ModIface, from which they are
      then looked up and warned about in the importing module in the `lookup_ie`
      helpers of the `filterImports` function (for the explicitly imported names)
      and in the `addUsedGRE(s)` functions where they warn about regular usages
      of the imported name.
      
      In terms of the AST information, the custom warning is stored in the
      extension field of the variants of the `IE` type (see Trees that Grow for
      more information).
      
      The commit includes a bump to the haddock submodule added in MR #28
      
      Signed-off-by: default avatarBartłomiej Cieślar <bcieslar2001@gmail.com>
      711b1d24
  5. Jun 19, 2023
    • Finley McIlwaine's avatar
      IPE data compression · cb9e1ce4
      Finley McIlwaine authored
      IPE data resulting from the `-finfo-table-map` flag may now be
      compressed by configuring the GHC build with the
      `--enable-ipe-data-compression` flag. This results in about a 20%
      reduction in the size of IPE-enabled build results.
      
      The compression library, zstd, may optionally be statically linked by
      configuring with the `--enabled-static-libzstd` flag (on non-darwin
      platforms)
      
      libzstd version 1.4.0 or greater is required.
      cb9e1ce4
  6. Jun 17, 2023
    • Andrei Borzenkov's avatar
      Type/data instances: require that variables on the RHS are mentioned on the LHS (#23512) · 800aad7e
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal #425 "Invisible binders in type declarations" restricts the
      scope of type and data family instances as follows:
      
        In type family and data family instances, require that every variable
        mentioned on the RHS must also occur on the LHS.
      
      For example, here are three equivalent type instance definitions accepted before this patch:
      
        type family F1 a :: k
        type instance F1 Int = Any :: j -> j
      
        type family F2 a :: k
        type instance F2 @(j -> j) Int = Any :: j -> j
      
        type family F3 a :: k
        type instance forall j. F3 Int = Any :: j -> j
      
      - In F1, j is implicitly quantified and it occurs only on the RHS;
      - In F2, j is implicitly quantified and it occurs both on the LHS and the RHS;
      - In F3, j is explicitly quantified.
      
      Now F1 is rejected with an out-of-scope error, while F2 and F3 continue to be accepted.
      800aad7e
  7. Jun 16, 2023
  8. Jun 15, 2023
    • Andrei Borzenkov's avatar
      Implement the -Wimplicit-rhs-quantification warning (#23510) · a71b60e9
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal #425 "Invisible binders in type declarations" forbids
      implicit quantification of type variables that occur free on the
      right-hand side of a type synonym but are not mentioned on the left-hand side.
      The users are expected to rewrite this using invisible binders:
      
          type T1 :: forall a . Maybe a
          type T1    = 'Nothing :: Maybe a      -- old
          type T1 @a = 'Nothing :: Maybe a      -- new
      
      Since the @k-binders are a new feature, we need to wait for three releases
      before we require the use of the new syntax. In the meantime, we ought to
      provide users with a new warning, -Wimplicit-rhs-quantification, that would
      detect when such implicit quantification takes place, and include it in -Wcompat.
      a71b60e9
  9. Jun 14, 2023
  10. Jun 13, 2023
  11. Jun 09, 2023
  12. Jun 07, 2023
    • Matthew Pickering's avatar
      Revert "Update user's guide and release notes, small fixes" · bad1c8cc
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This reverts commit 3ded9a1c.
      bad1c8cc
    • Vladislav Zavialov's avatar
      Invisible binders in type declarations (#22560) · 4aea0a72
      Vladislav Zavialov authored
      
      This patch implements @k-binders introduced in GHC Proposal #425
      and guarded behind the TypeAbstractions extension:
      
      	type D :: forall k j. k -> j -> Type
      	data D @k @j a b = ...
      	       ^^ ^^
      
      To represent the new syntax, we modify LHsQTyVars as follows:
      
      	-  hsq_explicit :: [LHsTyVarBndr () pass]
      	+  hsq_explicit :: [LHsTyVarBndr (HsBndrVis pass) pass]
      
      HsBndrVis is a new data type that records the distinction between
      type variable binders written with and without the @ sign:
      
      	data HsBndrVis pass
      	  = HsBndrRequired
      	  | HsBndrInvisible (LHsToken "@" pass)
      
      The rest of the patch updates GHC, template-haskell, and haddock
      to handle the new syntax.
      
      Parser:
        The PsErrUnexpectedTypeAppInDecl error message is removed.
        The syntax it used to reject is now permitted.
      
      Renamer:
        The @ sign does not affect the scope of a binder, so the changes to
        the renamer are minimal.  See rnLHsTyVarBndrVisFlag.
      
      Type checker:
        There are three code paths that were updated to deal with the newly
        introduced invisible type variable binders:
      
          1. checking SAKS: see kcCheckDeclHeader_sig, matchUpSigWithDecl
          2. checking CUSK: see kcCheckDeclHeader_cusk
          3. inference: see kcInferDeclHeader, rejectInvisibleBinders
      
        Helper functions bindExplicitTKBndrs_Q_Skol and bindExplicitTKBndrs_Q_Tv
        are generalized to work with HsBndrVis.
      
      Updates the haddock submodule.
      
      Metric Increase:
          MultiLayerModulesTH_OneShot
      
      Co-authored-by: default avatarSimon Peyton Jones <simon.peytonjones@gmail.com>
      4aea0a72
  13. Jun 01, 2023
    • Finley McIlwaine's avatar
      Update user's guide and release notes, small fixes · 3ded9a1c
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      Add mention of IPE data compression to user's guide and the release
      notes for 9.8.1. Also note the impact compression has on binary size in
      both places.
      
      Change IpeBufferListNode compression check so only the value `1`
      indicates compression.
      
      See ticket #21766
      3ded9a1c
  14. May 31, 2023
  15. May 26, 2023
  16. May 24, 2023
  17. May 23, 2023
    • Simon Peyton Jones's avatar
      Add the SolverStage monad · e1590ddc
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This refactoring makes a substantial improvement in the
      structure of the type-checker's constraint solver: #23070.
      
      Specifically:
      
      * Introduced the SolverStage monad.   See GHC.Tc.Solver.Monad
        Note [The SolverStage monad]
      
      * Make each solver pipeline (equalities, dictionaries, irreds etc)
        deal with updating the inert set, as a separate SolverStage.  There
        is sometimes special stuff to do, and it means that each full
        pipeline can have type SolverStage Void, indicating that they never
        return anything.
      
      * Made GHC.Tc.Solver.Equality.zonkEqTypes into a SolverStage.  Much nicer.
      
      * Combined the remnants of GHC.Tc.Solver.Canonical and
        GHC.Tc.Solver.Interact into a new module GHC.Tc.Solver.Solve.
        (Interact and Canonical are removed.)
      
      * Gave the same treatment to dictionary and irred constraints
        as I have already done for equality constraints:
          * New types (akin to EqCt): IrredCt and DictCt
          * Ct is now just a simple sum type
                data Ct
                  = CDictCan      DictCt
                  | CIrredCan     IrredCt
                  | CEqCan        EqCt
                  | CQuantCan     QCInst
                  | CNonCanonical CtEvidence
          * inert_dicts can now have the better type DictMap DictCt, instead of
            DictMap Ct; and similarly inert_irreds.
      
      * Significantly simplified the treatment of implicit parameters.
        Previously we had a number of special cases
          * interactGivenIP, an entire function
          * special case in maybeKickOut
          * special case in findDict, when looking up dictionaries
        But actually it's simpler than that. When adding a new Given, implicit
        parameter constraint to the InertSet, we just need to kick out any
        existing inert constraints that mention that implicit parameter.
      
        The main work is done in GHC.Tc.Solver.InertSet.delIPDict, along with
        its auxiliary GHC.Core.Predicate.mentionsIP.
      
        See Note [Shadowing of implicit parameters] in GHC.Tc.Solver.Dict.
      
      * Add a new fast-path in GHC.Tc.Errors.Hole.tcCheckHoleFit.
        See Note [Fast path for tcCheckHoleFit].  This is a big win in some cases:
        test hard_hole_fits gets nearly 40% faster (at compile time).
      
      * Add a new fast-path for solving /boxed/ equality constraints
        (t1 ~ t2).  See Note [Solving equality classes] in GHC.Tc.Solver.Dict.
        This makes a big difference too: test T17836 compiles 40% faster.
      
      * Implement the PermissivePlan of #23413, which concerns what happens with
        insoluble Givens.   Our previous treatment was wildly inconsistent as that
        ticket pointed out.
      
        A part of this, I simplified GHC.Tc.Validity.checkAmbiguity: now we simply
        don't run the ambiguity check at all if -XAllowAmbiguousTypes is on.
      
      Smaller points:
      
      * In `GHC.Tc.Errors.misMatchOrCND` instead of having a special case for
        insoluble /occurs/ checks, broaden in to all insouluble constraints.
        Just generally better. See Note [Insoluble mis-match] in that module.
      
      As noted above, compile time perf gets better.  Here are the changes
      over 0.5% on Fedora.  (The figures are slightly larger on Windows for
      some reason.)
      
      Metrics: compile_time/bytes allocated
      -------------------------------------
                      LargeRecord(normal)   -0.9%
      MultiLayerModulesTH_OneShot(normal)   +0.5%
                           T11822(normal)   -0.6%
                           T12227(normal)   -1.8% GOOD
                           T12545(normal)   -0.5%
                           T13035(normal)   -0.6%
                           T15703(normal)   -1.4% GOOD
                           T16875(normal)   -0.5%
                           T17836(normal)  -40.7% GOOD
                          T17836b(normal)  -12.3% GOOD
                          T17977b(normal)   -0.5%
                            T5837(normal)   -1.1%
                            T8095(normal)   -2.7% GOOD
                            T9020(optasm)   -1.1%
                   hard_hole_fits(normal)  -37.0% GOOD
      
                                geo. mean   -1.3%
                                minimum    -40.7%
                                maximum     +0.5%
      
      Metric Decrease:
          T12227
          T15703
          T17836
          T17836b
          T8095
          hard_hole_fits
          LargeRecord
          T9198
          T13035
      e1590ddc
  18. May 20, 2023
  19. May 18, 2023
  20. May 17, 2023
  21. May 16, 2023
  22. May 12, 2023
  23. May 11, 2023
    • sheaf's avatar
      Add fused multiply-add instructions · 87eebf98
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This patch adds eight new primops that fuse a multiplication and an
      addition or subtraction:
      
        - `{fmadd,fmsub,fnmadd,fnmsub}{Float,Double}#`
      
      fmadd x y z is x * y + z, computed with a single rounding step.
      
      This patch implements code generation for these primops in the following
      backends:
      
        - X86, AArch64 and PowerPC NCG,
        - LLVM
        - C
      
      WASM uses the C implementation. The primops are unsupported in the
      JavaScript backend.
      
      The following constant folding rules are also provided:
      
        - compute a * b + c when a, b, c are all literals,
        - x * y + 0 ==> x * y,
        - ±1 * y + z ==> z ± y and x * ±1 + z ==> z ± x.
      
      NB: the constant folding rules incorrectly handle signed zero.
      This is a known limitation with GHC's floating-point constant folding
      rules (#21227), which we hope to resolve in the future.
      87eebf98
  24. May 06, 2023
  25. May 04, 2023
  26. Apr 29, 2023
    • sheaf's avatar
      Add the Unsatisfiable class · 57277662
      sheaf authored
      This commit implements GHC proposal #433, adding the Unsatisfiable
      class to the GHC.TypeError module. This provides an alternative to
      TypeError for which error reporting is more predictable: we report it
      when we are reporting unsolved Wanted constraints.
      
      Fixes #14983 #16249 #16906 #18310 #20835
      57277662
  27. Apr 25, 2023
    • Andrei Borzenkov's avatar
      Give more guarntees about ImplicitParams (#23289) · 74c55712
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      - Added new section in the GHC user's guide that legends behavior of
      nested implicit parameter bindings in these two cases:
      
        let ?f = 1 in let ?f = 2 in ?f
      
      and
      
        data T where MkT :: (?f :: Int) => T
      
        f :: T -> T -> Int
        f MkT MkT = ?f
      
      - Added new test case to examine this behavior.
      74c55712
  28. Apr 21, 2023
  29. Apr 20, 2023
    • sheaf's avatar
      Implement -jsem: parallelism controlled by semaphores · 5c873124
      sheaf authored and Marge Bot's avatar Marge Bot committed
      See https://github.com/ghc-proposals/ghc-proposals/pull/540/ for a
      complete description for the motivation for this feature.
      
      The `-jsem` option allows a build tool to pass a semaphore to GHC which
      GHC can use in order to control how much parallelism it requests.
      
      GHC itself acts as a client in the GHC jobserver protocol.
      
      ```
      GHC Jobserver Protocol
      ~~~~~~~~~~~~~~~~~~~~~~
      
      This proposal introduces the GHC Jobserver Protocol. This protocol allows
      a server to dynamically invoke many instances of a client process,
      while restricting all of those instances to use no more than <n> capabilities.
      This is achieved by coordination over a system semaphore (either a POSIX
      semaphore [6]_  in the case of Linux and Darwin, or a Win32 semaphore [7]_
      in the case of Windows platforms).
      
      There are two kinds of participants in the GHC Jobserver protocol:
      
      - The *jobserver* creates a system semaphore with a certain number of
        available tokens.
      
        Each time the jobserver wants to spawn a new jobclient subprocess, it **must**
        first acquire a single token from the semaphore, before spawning
        the subprocess. This token **must** be released once the subprocess terminates.
      
        Once work is finished, the jobserver **must** destroy the semaphore it created.
      
      - A *jobclient* is a subprocess spawned by the jobserver or another jobclient.
      
        Each jobclient starts with one available token (its *implicit token*,
        which was acquired by the parent which spawned it), and can request more
        tokens through the Jobserver Protocol by waiting on the semaphore.
      
        Each time a jobclient wants to spawn a new jobclient subprocess, it **must**
        pass on a single token to the child jobclient. This token can either be the
        jobclient's implicit token, or another token which the jobclient acquired
        from the semaphore.
      
        Each jobclient **must** release exactly as many tokens as it has acquired from
        the semaphore (this does not include the implicit tokens).
      ```
      
      Build tools such as cabal act as jobservers in the protocol and are
      responsibile for correctly creating, cleaning up and managing the
      semaphore.
      
      Adds a new submodule (semaphore-compat) for managing and interacting
      with semaphores in a cross-platform way.
      
      Fixes #19349
      5c873124
    • Sylvain Henry's avatar
      Testsuite: don't use obsolescent egrep (#22351) · ab6c1d29
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Recent egrep displays the following message, breaking golden tests:
      
        egrep: warning: egrep is obsolescent; using grep -E
      
      Switch to using "grep -E" instead
      ab6c1d29
  30. Apr 17, 2023
    • Ryan Scott's avatar
      validDerivPred: Reject exotic constraints in IrredPreds · 0158c5f1
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      This brings the `IrredPred` case in sync with the treatment of `ClassPred`s as
      described in `Note [Valid 'deriving' predicate]` in `GHC.Tc.Validity`. Namely,
      we should reject `IrredPred`s that are inferred from `deriving` clauses whose
      arguments contain other type constructors, as described in `(VD2) Reject exotic
      constraints` of that Note.  This has the nice property that `deriving` clauses
      whose inferred instance context mention `TypeError` will now emit the type
      error in the resulting error message, which better matches existing intuitions
      about how `TypeError` should work.
      
      While I was in town, I noticed that much of `Note [Valid 'deriving' predicate]`
      was duplicated in a separate `Note [Exotic derived instance contexts]` in
      `GHC.Tc.Deriv.Infer`. I decided to fold the latter Note into the former so that
      there is a single authority on describing the conditions under which an
      inferred `deriving` constraint can be considered valid.
      
      This changes the behavior of `deriving` in a way that existing code might
      break, so I have made a mention of this in the GHC User's Guide. It seems very,
      very unlikely that much code is relying on this strange behavior, however, and
      even if there is, there is a clear, backwards-compatible migration path using
      `StandaloneDeriving`.
      
      Fixes #22696.
      0158c5f1
Loading