[Git][ghc/ghc][wip/tyconapp-opts] 20 commits: Implement type applications in patterns

Ben Gamari gitlab at gitlab.haskell.org
Mon Dec 14 17:45:41 UTC 2020



Ben Gamari pushed to branch wip/tyconapp-opts at Glasgow Haskell Compiler / GHC


Commits:
90945a22 by Cale Gibbard at 2020-12-11T12:36:23-05:00
Implement type applications in patterns

The haddock submodule is also updated so that it understands the changes
to patterns.

- - - - -
0f15a2da by Sylvain Henry at 2020-12-14T12:45:26-05:00
Display FFI labels (fix #18539)

- - - - -
46f1da59 by Aaron Allen at 2020-12-14T12:45:26-05:00
Elide extraneous messages for :doc command (#15784)

Do not print `<has no documentation>` alongside a valid doc.
Additionally, if two matching symbols lack documentation then the
message will only be printed once. Hence, `<has no documentation>` will
be printed at most once and only if all matching symbols are lacking
docs.

- - - - -
d5c31cd0 by Aaron Allen at 2020-12-14T12:45:26-05:00
Add :doc test case for duplicate record fields

Tests that the output of the `:doc` command is correct for duplicate
record fields defined using -XDuplicateRecordFields.

- - - - -
7af03d60 by Ryan Scott at 2020-12-14T12:45:26-05:00
Delete outdated Note [Kind-checking tyvar binders for associated types]

This Note has severely bitrotted, as it has no references anywhere in the
codebase, and none of the functions that it mentions exist anymore. Let's just
delete this. While I was in town, I deleted some outdated comments from
`checkFamPatBinders` of a similar caliber.

Fixes #19008.

[ci skip]

- - - - -
e733612b by Sylvain Henry at 2020-12-14T12:45:26-05:00
Arrows: correctly query arrow methods (#17423)

Consider the following code:

    proc (C x y) -> ...

Before this patch, the evidence binding for the Arrow dictionary was
attached to the C pattern:

    proc (C x y) { $dArrow = ... } -> ...

But then when we desugar this, we use arrow operations ("arr", ">>>"...)
specialised for this arrow:

    let
        arr_xy = arr $dArrow -- <-- Not in scope!
        ...
    in
        arr_xy (\(C x y) { $dArrow = ... } -> ...)

This patch allows arrow operations to be type-checked before the proc
itself, avoiding this issue.

Fix #17423

- - - - -
3f9fa2a2 by Sylvain Henry at 2020-12-14T12:45:26-05:00
Validate script: fix configure command when using stack

- - - - -
ec7926de by Sylvain Henry at 2020-12-14T12:45:26-05:00
Hadrian: fix libffi tarball parsing

Fix parsing of "libffi-3.3.tar.gz".

NB: switch to a newer libffi isn't done in this patch

- - - - -
8c8884ff by Sylvain Henry at 2020-12-14T12:45:26-05:00
Parser: move parser utils into their own module

Move code unrelated to runtime evaluation out of GHC.Runtime.Eval

- - - - -
7e029c9a by Sylvain Henry at 2020-12-14T12:45:26-05:00
Move SizedSeq into ghc-boot

- - - - -
039e76f9 by Sylvain Henry at 2020-12-14T12:45:26-05:00
ghci: don't compile unneeded modules

- - - - -
08e38cae by Sylvain Henry at 2020-12-14T12:45:26-05:00
ghci: reuse Arch from ghc-boot

- - - - -
ef6c6ecf by Sylvain Henry at 2020-12-14T12:45:26-05:00
rts: don't use siginterrupt (#19019)

- - - - -
f10df0ea by Sylvain Henry at 2020-12-14T12:45:26-05:00
Use static array in zeroCount

- - - - -
cdcdb4aa by Sebastian Graf at 2020-12-14T12:45:26-05:00
DmdAnal: Annotate top-level function bindings with demands (#18894)

It's useful to annotate a non-exported top-level function like `g` in

```hs
module Lib (h) where

g :: Int -> Int -> (Int,Int)
g m 1 = (m, 0)
g m n = (2 * m, 2 `div` n)
{-# NOINLINE g #-}

h :: Int -> Int
h 1 = 0
h m
  | odd m     = snd (g m 2)
  | otherwise = uncurry (+) (g 2 m)
```

with its demand `UCU(CS(P(1P(U),SP(U))`, which tells us that whenever `g` was
called, the second component of the returned pair was evaluated strictly.

Since #18903 we do so for local functions, where we can see all calls.
For top-level functions, we can assume that all *exported* functions are
demanded according to `topDmd` and thus get sound demands for
non-exported top-level functions.

The demand on `g` is crucial information for Nested CPR, which may the
go on and unbox `g` for the second pair component. That is true even if
that pair component may diverge, as is the case for the call site `g 13
0`, which throws a div-by-zero exception.

In `T18894b`, you can even see the new demand annotation enabling us to
eta-expand a function that we wouldn't be able to eta-expand without
Call Arity.

We only track bindings of function type in order not to risk huge compile-time
regressions, see `isInterestingTopLevelFn`.

There was a CoreLint check that rejected strict demand annotations on
recursive or top-level bindings, which seems completely unjustified.
All the cases I investigated were fine, so I removed it.

Fixes #18894.

- - - - -
19068448 by Sebastian Graf at 2020-12-14T12:45:26-05:00
Demand: Simplify `CU(U)` to `U` (#19005)

Both sub-demands encode the same information.
This is a trivial change and already affects a few regression tests
(e.g. `T5075`), so no separate regression test is necessary.

- - - - -
0202bd49 by Adam Sandberg Ericsson at 2020-12-14T12:45:26-05:00
hadrian: correctly copy the docs dir into the bindist #18669

- - - - -
6ead906f by Adam Sandberg Ericsson at 2020-12-14T12:45:26-05:00
mkDocs: support hadrian bindists #18973

- - - - -
547a01dc by John Ericson at 2020-12-14T12:45:26-05:00
Remove old .travis.yml

- - - - -
6f404e92 by Ben Gamari at 2020-12-14T12:45:26-05:00
Optimise nullary type constructor usage

During the compilation of programs GHC very frequently deals with
the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch
teaches GHC to avoid expanding the `Type` synonym (and other nullary
type synonyms) during type comparisons, saving a good amount of work.
This optimisation is described in `Note [Comparing nullary type
synonyms]`.

To maximize the impact of this optimisation, we introduce a few
special-cases to reduce `TYPE 'LiftedRep` to `Type`. See
`Note [Prefer Type over TYPE 'LiftedPtrRep]`.

Closes #17958.

Metric Decrease:
   T18698b
   T1969
   T12227
   T12545
   T12707
   T14683
   T3064
   T5631
   T5642
   T9020
   T9630
   T9872a
   T13035
   haddock.Cabal
   haddock.base

- - - - -


30 changed files:

- − .travis.yml
- compiler/GHC.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- + compiler/GHC/Builtin/Types/Prim.hs-boot
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Constructor.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d9ce91b73513f997f3fc5a94ccdde68014e055c6...6f404e9285a848f847a6880bfe836a3f3bdef8e4

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d9ce91b73513f997f3fc5a94ccdde68014e055c6...6f404e9285a848f847a6880bfe836a3f3bdef8e4
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201214/ccedf806/attachment-0001.html>


More information about the ghc-commits mailing list