Skip to content
Snippets Groups Projects
  1. Feb 27, 2021
  2. Feb 26, 2021
    • Andreas Klebinger's avatar
      Move absentError into ghc-prim. · a9f23793
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      When using -fdicts-strict we generate references to absentError while
      compiling ghc-prim. However we always load ghc-prim before base so this
      caused linker errors.
      
      We simply solve this by moving absentError into ghc-prim. This does mean
      it's now a panic instead of an exception which can no longer be caught.
      But given that it should only be thrown if there is a compiler error
      that seems acceptable, and in fact we already do this for
      absentSumFieldError which has similar constraints.
      a9f23793
    • Matthew Pickering's avatar
      Reimplement Stream in "yoneda" style for efficiency · 24777bb3
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      'Stream' is implemented in the "yoneda" style for efficiency. By
      representing a stream in this manner 'fmap' and '>>=' operations are
      accumulated in the function parameters before being applied once when
      the stream is destroyed. In the old implementation each usage of 'mapM'
      and '>>=' would traverse the entire stream in order to apply the
      substitution at the leaves. It is well-known for free monads that this
      representation can improve performance, and the test results
      demonstrate this for GHC as well.
      
      The operation mapAccumL is not used in the compiler and can't be
      implemented efficiently because it requires destroying and rebuilding
      the stream.
      
      I removed one use of mapAccumL_ which has similar problems but the other
      use was difficult to remove. In the future it may be worth exploring
      whether the 'Stream' encoding could be modified further to capture the
      mapAccumL pattern, and likewise defer the passing of accumulation
      parameter until the stream is finally consumed.
      
      The >>= operation for 'Stream' was a hot-spot in the ticky profile for
      the "ManyConstructors" test which called the 'cg' function many times in
      "StgToCmm.hs"
      
      Metric Decrease:
          ManyConstructors
      24777bb3
    • Ryan Scott's avatar
      Fix #19363 by using pprName' {Applied,Infix} in the right places · 8d1fb46d
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      It was revealed in #19363 that the Template Haskell pretty-printer implemented
      in `Language.Haskell.TH.Ppr` did not pretty-print infix names or symbolic names
      correctly in certain situations, such as in data constructor declarations or
      fixity declarations. Easily fixed by using `pprName' Applied` (which always
      parenthesizes symbolic names in prefix position) or `pprName' Infix` (which
      always surrounds alphanumeric names with backticks in infix position) in the
      right spots.
      
      Fixes #19363.
      8d1fb46d
    • Adam Gundry's avatar
      Implement -Wambiguous-fields · 80eda911
      Adam Gundry authored and Marge Bot's avatar Marge Bot committed
      Fixes #18966. Adds a new warning -Wambiguous-fields for uses of field selectors
      or record updates that will be rejected in the future, when the DuplicateRecordFields
      extension is simplified per https://github.com/ghc-proposals/ghc-proposals/pull/366.
      80eda911
    • Simon Peyton Jones's avatar
      Update MonoLocalBinds documentation · 29e7f318
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      Update the documentation to specify that MonoLocalBinds is lifted
      by a partial type signature.
      
      This came up in #19396.
      
      [skip ci]
      29e7f318
    • Sebastian Graf's avatar
      hadrian: ticky_ghc should build all things with -ticky (#19405) [skip ci] · 98cb9402
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      With this patch, everything built by the stage1 compiler (in a
      `ticky_ghc`-transformed flavour) will be built with `-ticky`.
      
      Fixes #19405.
      98cb9402
    • utdemir's avatar
      Minor fix to QualifiedDo docs about the ApplicativeDo desugaring · bc12e7ec
      utdemir authored and Marge Bot's avatar Marge Bot committed
      When desugaring ApplicativeDo, GHC looks up the name `fmap`, not `<$>`
      (see 'GHC.Builtin.Names.fmapName'). This commit fixes the misleading
      documentation; since exporting the name `<$>` instead of `fmap` causes a
      "not in scope" error when `QualifiedDo` and `ApplicativeDo` is combined.
      
      [skip ci]
      bc12e7ec
  3. Feb 24, 2021
  4. Feb 23, 2021
  5. Feb 22, 2021
  6. Feb 19, 2021
    • Simon Peyton Jones's avatar
      Improve handling of overloaded labels, literals, lists etc · 4196969c
      Simon Peyton Jones authored
      When implementing Quick Look I'd failed to remember that overloaded
      labels, like #foo, should be treated as a "head", so that they can be
      instantiated with Visible Type Application. This caused #19154.
      
      A very similar ticket covers overloaded literals: #19167.
      
      This patch fixes both problems, but (annoyingly, albeit temporarily)
      in two different ways.
      
      Overloaded labels
      
      I dealt with overloaded labels by buying fully into the
      Rebindable Syntax approach described in GHC.Hs.Expr
      Note [Rebindable syntax and HsExpansion].
      
      There is a good overview in GHC.Rename.Expr
      Note [Handling overloaded and rebindable constructs].
      That module contains much of the payload for this patch.
      
      Specifically:
      
      * Overloaded labels are expanded in the renamer, fixing #19154.
        See Note [Overloaded labels] in GHC.Rename.Expr.
      
      * Left and right sections used to have special code paths in the
        typechecker and desugarer.  Now we just expand them in the
        renamer. This is harder than it sounds.  See GHC.Rename.Expr
        Note [Left and right sections].
      
      * Infix operator applications are expanded in the typechecker,
        specifically in GHC.Tc.Gen.App.splitHsApps.  See
        Note [Desugar OpApp in the typechecker] in that module
      
      * ExplicitLists are expanded in the renamer, when (and only when)
        OverloadedLists is on.
      
      * HsIf is expanded in the renamer when (and only when) RebindableSyntax
        is on.  Reason: the coverage checker treats HsIf specially.  Maybe
        we could instead expand it unconditionally, and fix up the coverage
        checker, but I did not attempt that.
      
      Overloaded literals
      
      Overloaded literals, like numbers (3, 4.2) and strings with
      OverloadedStrings, were not working correctly with explicit type
      applications (see #19167).  Ideally I'd also expand them in the
      renamer, like the stuff above, but I drew back on that because they
      can occur in HsPat as well, and I did not want to to do the HsExpanded
      thing for patterns.
      
      But they *can* now be the "head" of an application in the typechecker,
      and hence something like ("foo" @T) works now.  See
      GHC.Tc.Gen.Head.tcInferOverLit.  It's also done a bit more elegantly,
      rather than by constructing a new HsExpr and re-invoking the
      typechecker. There is some refactoring around tcShortCutLit.
      
      Ultimately there is more to do here, following the Rebindable Syntax
      story.
      
      There are a lot of knock-on effects:
      
      * HsOverLabel and ExplicitList no longer need funny (Maybe SyntaxExpr)
        fields to support rebindable syntax -- good!
      
      * HsOverLabel, OpApp, SectionL, SectionR all become impossible in the
        output of the typecheker, GhcTc; so we set their extension fields to
        Void. See GHC.Hs.Expr Note [Constructor cannot occur]
      
      * Template Haskell quotes for HsExpanded is a bit tricky.  See
        Note [Quotation and rebindable syntax] in GHC.HsToCore.Quote.
      
      * In GHC.HsToCore.Match.viewLExprEq, which groups equal HsExprs for the
        purpose of pattern-match overlap checking, I found that dictionary
        evidence for the same type could have two different names.  Easily
        fixed by comparing types not names.
      
      * I did quite a bit of annoying fiddling around in GHC.Tc.Gen.Head and
        GHC.Tc.Gen.App to get error message locations and contexts right,
        esp in splitHsApps, and the HsExprArg type.  Tiresome and not very
        illuminating.  But at least the tricky, higher order, Rebuilder
        function is gone.
      
      * Some refactoring in GHC.Tc.Utils.Monad around contexts and locations
        for rebindable syntax.
      
      * Incidentally fixes #19346, because we now print renamed, rather than
        typechecked, syntax in error mesages about applications.
      
      The commit removes the vestigial module GHC.Builtin.RebindableNames,
      and thus triggers a 2.4% metric decrease for test MultiLayerModules
      (#19293).
      
      Metric Decrease:
          MultiLayerModules
          T12545
      4196969c
  7. Feb 18, 2021
Loading