| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Here we introduce a new data structure, RoughMap, inspired by the
previous `RoughTc` matching mechanism for checking instance matches.
This allows [Fam]InstEnv to be implemented as a trie indexed by these
RoughTc signatures, reducing the complexity of instance lookup and
FamInstEnv merging (done during the family instance conflict test)
from O(n) to O(log n).
The critical performance improvement currently realised by this patch is
in instance matching. In particular the RoughMap mechanism allows us to
discount many potential instances which will never match for constraints
involving type variables (see Note [Matching a RoughMap]). In realistic
code bases matchInstEnv was accounting for 50% of typechecker time due
to redundant work checking instances when simplifying instance contexts
when deriving instances. With this patch the cost is significantly
reduced.
The larger constants in InstEnv creation do mean that a few small
tests regress in allocations slightly. However, the runtime of T19703 is
reduced by a factor of 4. Moreover, the compilation time of the Cabal
library is slightly improved.
A couple of test cases are included which demonstrate significant
improvements in compile time with this patch.
This unfortunately does not fix the testcase provided in #19703 but does
fix #20933
-------------------------
Metric Decrease:
T12425
Metric Increase:
T13719
T9872a
T9872d
hard_hole_fits
-------------------------
Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
|
|
|
|
|
|
| |
This patch ensures that the pretty printer formats LambdaCase and where
clauses using braces (instead of layout) to remain consistent with the
formatting of other statements (like `do` and `case`)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implementation for Ticket #16393.
Explicit specificity allows users to manually create inferred type variables,
by marking them with braces.
This way, the user determines which variables can be instantiated through
visible type application.
The additional syntax is included in the parser, allowing users to write
braces in type variable binders (type signatures, data constructors etc).
This information is passed along through the renamer and verified in the
type checker.
The AST for type variable binders, data constructors, pattern synonyms,
partial signatures and Template Haskell has been updated to include the
specificity of type variables.
Minor notes:
- Bumps haddock submodule
- Disables pattern match checking in GHC.Iface.Type with GHC 8.8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch implements visible kind application (GHC Proposal 15/#12045), as well as #15360 and #15362.
It also refactors unnamed wildcard handling, and requires that type equations in type families in Template Haskell be
written with full type on lhs. PartialTypeSignatures are on and warnings are off automatically with visible kind
application, just like in term-level.
There are a few remaining issues with this patch, as documented in
ticket #16082.
Includes a submodule update for Haddock.
Test Plan: Tests T12045a/b/c/TH1/TH2, T15362, T15592a
Reviewers: simonpj, goldfire, bgamari, alanz, RyanGlScott, Iceland_jack
Subscribers: ningning, Iceland_jack, RyanGlScott, int-index, rwbarton, mpickering, carter
GHC Trac Issues: `#12045`, `#15362`, `#15592`, `#15788`, `#15793`, `#15795`, `#15797`, `#15799`, `#15801`, `#15807`, `#15816`
Differential Revision: https://phabricator.haskell.org/D5229
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Currently, reifying classes produces class methods with
redundant tyvars and class contexts in their type signatures, such
as in the following:
```lang=haskell
class C a where
method :: forall a. C a => a
```
Fixing this is very straightforward: just apply `tcSplitMethodTy` to
the type of each class method to lop off the redundant parts.
It's possible that this could break some TH code in the wild that
assumes the existence of these tyvars and class contexts, so I'll
advertise this change in the release notes just to be safe.
Test Plan: make test TEST="TH_reifyDecl1 T9064 T10891 T14888"
Reviewers: goldfire, bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, carter
GHC Trac Issues: #15551
Differential Revision: https://phabricator.haskell.org/D5088
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As reported in Trac #10891, Template Haskell's `reify` was not
generating Decls for associated types. This patch fixes that.
Note that even though `reifyTyCon` function used in this patch returns
some type instances, I'm ignoring that.
Here's an example of how associated types are encoded with this patch:
(Simplified representation)
class C a where
type F a :: *
-->
OpenTypeFamilyD "F" ["a"]
With default type instances:
class C a where
type F a :: *
type F a = a
-->
OpenTypeFamilyD "F" ["a"]
TySynInstD "F" (TySynEqn [VarT "a"] "a")
Test Plan:
This patch was already reviewed and even merged. The patch is later
reverted because apparently it broke the build some time between the
validation of this patch and merge. Creating this new ticket to fix the
validation.
Reviewers: goldfire, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1277
GHC Trac Issues: #10891
|
|
|
|
|
|
| |
This caused the build to fail, due to some type checking errors. Whoops.
This reverts commit 5c115236fe795aa01f0c10106f1b1c959486a739.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As reported in Trac #10891, Template Haskell's `reify` was not generating Decls
for associated types. This patch fixes that.
Note that even though `reifyTyCon` function used in this patch returns some
type instances, I'm ignoring that.
Here's an example of how associated types are encoded with this patch:
(Simplified representation)
class C a where
type F a :: *
-->
OpenTypeFamilyD "F" ["a"]
With default type instances:
class C a where
type F a :: *
type F a = a
-->
OpenTypeFamilyD "F" ["a"]
TySynInstD "F" (TySynEqn [VarT "a"] "a")
Reviewed By: goldfire
Differential Revision: https://phabricator.haskell.org/D1254
GHC Trac Issues: #10891
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Template Haskell allows reification of fixity for infix functions and
data constructors, and not for infix types. This adds a `Fixity` field
to the relevant `Info` constructors that can have infix types (`ClassI`,
`TyConI`, and `FamilyI`).
I don't think that `VarI` or `PrimTyConI` can be infix, but I could be
wrong.
Test Plan: ./validate
Reviewers: austin, goldfire, bgamari
Reviewed By: goldfire, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1109
GHC Trac Issues: #10704
|
| |
|
|
|
|
|
|
|
|
|
| |
There were two unrelated errors fixed here:
1) Make sure that only the *result kind* is reified when reifying
a type family. Previously, the whole kind was reified, which
defies the TH spec.
2) Omit kind patterns in equations.
|
| |
|
|
|
|
|
|
| |
Many of the files modified are just wibbles to output, because now
tycons have roles attached to them, which are produced in the debugging
dumps.
|
|
|
|
| |
major TcErrors refactoring
|
| |
|
|
|