[commit: ghc] wip/T13633, wip/non-det-ci: Add AnonArgFlag to FunTy (6cce36f)

git at git.haskell.org git at git.haskell.org
Sun Feb 24 20:54:46 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branches: wip/T13633,wip/non-det-ci
Link       : http://ghc.haskell.org/trac/ghc/changeset/6cce36f83aec33d33545e0ef2135894d22dff5ca/ghc

>---------------------------------------------------------------

commit 6cce36f83aec33d33545e0ef2135894d22dff5ca
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Feb 15 09:53:48 2019 +0000

    Add AnonArgFlag to FunTy
    
    The big payload of this patch is:
    
      Add an AnonArgFlag to the FunTy constructor
      of Type, so that
        (FunTy VisArg   t1 t2) means (t1 -> t2)
        (FunTy InvisArg t1 t2) means (t1 => t2)
    
    The big payoff is that we have a simple, local test to make
    when decomposing a type, leading to many fewer calls to
    isPredTy. To me the code seems a lot tidier, and probably
    more efficient (isPredTy has to take the kind of the type).
    
    See Note [Function types] in TyCoRep.
    
    There are lots of consequences
    
    * I made FunTy into a record, so that it'll be easier
      when we add a linearity field, something that is coming
      down the road.
    
    * Lots of code gets touched in a routine way, simply because it
      pattern matches on FunTy.
    
    * I wanted to make a pattern synonym for (FunTy2 arg res), which
      picks out just the argument and result type from the record. But
      alas the pattern-match overlap checker has a heart attack, and
      either reports false positives, or takes too long.  In the end
      I gave up on pattern synonyms.
    
      There's some commented-out code in TyCoRep that shows what I
      wanted to do.
    
    * Much more clarity about predicate types, constraint types
      and (in particular) equality constraints in kinds.  See TyCoRep
      Note [Types for coercions, predicates, and evidence]
      and Note [Constraints in kinds].
    
      This made me realise that we need an AnonArgFlag on
      AnonTCB in a TyConBinder, something that was really plain
      wrong before. See TyCon Note [AnonTCB InivsArg]
    
    * When building function types we must know whether we
      need VisArg (mkVisFunTy) or InvisArg (mkInvisFunTy).
      This turned out to be pretty easy in practice.
    
    * Pretty-printing of types, esp in IfaceType, gets
      tidier, because we were already recording the (->)
      vs (=>) distinction in an ad-hoc way.  Death to
      IfaceFunTy.
    
    * mkLamType needs to keep track of whether it is building
      (t1 -> t2) or (t1 => t2).  See Type
      Note [mkLamType: dictionary arguments]
    
    Other minor stuff
    
    * Some tidy-up in validity checking involving constraints;
      Trac #16263


>---------------------------------------------------------------

6cce36f83aec33d33545e0ef2135894d22dff5ca
 compiler/backpack/RnModIface.hs                    |   6 +-
 compiler/basicTypes/DataCon.hs                     |  39 +--
 compiler/basicTypes/MkId.hs                        |  19 +-
 compiler/basicTypes/PatSyn.hs                      |   4 +-
 compiler/basicTypes/Var.hs                         |  32 +-
 compiler/basicTypes/Var.hs-boot                    |  15 +
 compiler/codeGen/StgCmmClosure.hs                  |   6 +-
 compiler/coreSyn/CoreFVs.hs                        |   2 +-
 compiler/coreSyn/CoreLint.hs                       |   6 +-
 compiler/coreSyn/CoreMap.hs                        |   6 +-
 compiler/coreSyn/CoreUtils.hs                      |   9 +-
 compiler/coreSyn/MkCore.hs                         |   6 +-
 compiler/deSugar/DsCCall.hs                        |   6 +-
 compiler/deSugar/DsForeign.hs                      |   4 +-
 compiler/deSugar/DsListComp.hs                     |   6 +-
 compiler/deSugar/DsUtils.hs                        |   2 +-
 compiler/ghci/ByteCodeGen.hs                       |   2 +-
 compiler/ghci/RtClosureInspect.hs                  |   6 +-
 compiler/hieFile/HieAst.hs                         |   4 +-
 compiler/hieFile/HieUtils.hs                       |  14 +-
 compiler/hsSyn/HsUtils.hs                          |  15 +-
 compiler/iface/BuildTyCl.hs                        |   3 +-
 compiler/iface/IfaceSyn.hs                         |   5 +-
 compiler/iface/IfaceType.hs                        |  53 ++-
 compiler/iface/TcIface.hs                          |  11 +-
 compiler/iface/ToIface.hs                          |   7 +-
 compiler/prelude/PrimOp.hs                         |   8 +-
 compiler/prelude/TysPrim.hs                        |  13 +-
 compiler/prelude/TysWiredIn.hs                     |  39 ++-
 compiler/prelude/TysWiredIn.hs-boot                |   5 -
 compiler/simplCore/SimplUtils.hs                   |   4 +-
 compiler/simplStg/RepType.hs                       |   4 +-
 compiler/typecheck/ClsInst.hs                      |   2 +-
 compiler/typecheck/FamInst.hs                      |   2 +-
 compiler/typecheck/Inst.hs                         | 166 ++-------
 compiler/typecheck/TcArrows.hs                     |   4 +-
 compiler/typecheck/TcCanonical.hs                  |  15 +-
 compiler/typecheck/TcDerivInfer.hs                 |   2 +-
 compiler/typecheck/TcErrors.hs                     |   5 +-
 compiler/typecheck/TcEvidence.hs                   |   2 +-
 compiler/typecheck/TcExpr.hs                       |  10 +-
 compiler/typecheck/TcFlatten.hs                    |  14 +-
 compiler/typecheck/TcForeign.hs                    |   4 +-
 compiler/typecheck/TcGenDeriv.hs                   |   8 +-
 compiler/typecheck/TcGenFunctor.hs                 |   9 +-
 compiler/typecheck/TcHoleErrors.hs                 |   2 +-
 compiler/typecheck/TcHsType.hs                     |  57 ++--
 compiler/typecheck/TcInstDcls.hs                   |   3 +-
 compiler/typecheck/TcMType.hs                      |  22 +-
 compiler/typecheck/TcMatches.hs                    |  28 +-
 compiler/typecheck/TcPat.hs                        |   2 +-
 compiler/typecheck/TcPatSyn.hs                     |  12 +-
 compiler/typecheck/TcRnDriver.hs                   |   3 +-
 compiler/typecheck/TcRnTypes.hs                    |   2 +-
 compiler/typecheck/TcSMonad.hs                     |   6 +-
 compiler/typecheck/TcSigs.hs                       |   5 +-
 compiler/typecheck/TcSimplify.hs                   |   2 +-
 compiler/typecheck/TcSplice.hs                     |   8 +-
 compiler/typecheck/TcTyClsDecls.hs                 |  26 +-
 compiler/typecheck/TcTyDecls.hs                    |  22 +-
 compiler/typecheck/TcType.hs                       | 102 +++---
 compiler/typecheck/TcTypeable.hs                   |  15 +-
 compiler/typecheck/TcUnify.hs                      |  29 +-
 compiler/typecheck/TcValidity.hs                   |  68 ++--
 compiler/types/Coercion.hs                         |  11 +-
 compiler/types/FamInstEnv.hs                       |  13 +-
 compiler/types/Kind.hs                             |   2 +-
 compiler/types/OptCoercion.hs                      |   4 -
 compiler/types/TyCoRep.hs                          | 378 ++++++++++++++++-----
 compiler/types/TyCoRep.hs-boot                     |   6 +-
 compiler/types/TyCon.hs                            | 101 +++---
 compiler/types/Type.hs                             | 320 +++++++++--------
 compiler/types/Unify.hs                            |   4 +-
 docs/users_guide/glasgow_exts.rst                  |  22 ++
 testsuite/tests/callarity/unittest/CallArity1.hs   |  12 +-
 testsuite/tests/dependent/should_fail/T15215.hs    |   4 +
 .../tests/dependent/should_fail/T15215.stderr      |  11 +-
 testsuite/tests/polykinds/all.T                    |   1 -
 testsuite/tests/typecheck/should_fail/T12102.hs    |   5 +-
 .../tests/typecheck/should_fail/T12102.stderr      |   6 -
 testsuite/tests/typecheck/should_fail/all.T        |   2 +-
 utils/genprimopcode/Main.hs                        |   4 +-
 utils/haddock                                      |   2 +-
 83 files changed, 1046 insertions(+), 880 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6cce36f83aec33d33545e0ef2135894d22dff5ca


More information about the ghc-commits mailing list