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
Showing
- compiler/backpack/RnModIface.hs 2 additions, 4 deletionscompiler/backpack/RnModIface.hs
- compiler/basicTypes/DataCon.hs 18 additions, 21 deletionscompiler/basicTypes/DataCon.hs
- compiler/basicTypes/MkId.hs 10 additions, 9 deletionscompiler/basicTypes/MkId.hs
- compiler/basicTypes/PatSyn.hs 2 additions, 2 deletionscompiler/basicTypes/PatSyn.hs
- compiler/basicTypes/Var.hs 30 additions, 2 deletionscompiler/basicTypes/Var.hs
- compiler/basicTypes/Var.hs-boot 15 additions, 0 deletionscompiler/basicTypes/Var.hs-boot
- compiler/codeGen/StgCmmClosure.hs 3 additions, 3 deletionscompiler/codeGen/StgCmmClosure.hs
- compiler/coreSyn/CoreFVs.hs 1 addition, 1 deletioncompiler/coreSyn/CoreFVs.hs
- compiler/coreSyn/CoreLint.hs 3 additions, 3 deletionscompiler/coreSyn/CoreLint.hs
- compiler/coreSyn/CoreMap.hs 5 additions, 1 deletioncompiler/coreSyn/CoreMap.hs
- compiler/coreSyn/CoreUtils.hs 5 additions, 4 deletionscompiler/coreSyn/CoreUtils.hs
- compiler/coreSyn/MkCore.hs 3 additions, 3 deletionscompiler/coreSyn/MkCore.hs
- compiler/deSugar/DsCCall.hs 3 additions, 3 deletionscompiler/deSugar/DsCCall.hs
- compiler/deSugar/DsForeign.hs 2 additions, 2 deletionscompiler/deSugar/DsForeign.hs
- compiler/deSugar/DsListComp.hs 3 additions, 3 deletionscompiler/deSugar/DsListComp.hs
- compiler/deSugar/DsUtils.hs 1 addition, 1 deletioncompiler/deSugar/DsUtils.hs
- compiler/ghci/ByteCodeGen.hs 1 addition, 1 deletioncompiler/ghci/ByteCodeGen.hs
- compiler/ghci/RtClosureInspect.hs 3 additions, 3 deletionscompiler/ghci/RtClosureInspect.hs
- compiler/hieFile/HieAst.hs 2 additions, 2 deletionscompiler/hieFile/HieAst.hs
- compiler/hieFile/HieUtils.hs 7 additions, 7 deletionscompiler/hieFile/HieUtils.hs
Loading
-
mentioned in issue #12102 (closed)
-
mentioned in issue #15799 (closed)
-
mentioned in issue #15872 (closed)
-
mentioned in issue #16185 (closed)
-
mentioned in issue #16263 (closed)
-
mentioned in commit 4bc90b32
Please register or sign in to comment