Simon Peyton Jones pushed to branch wip/T26543b at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Core/Coercion/Opt.hs
    ... ... @@ -44,7 +44,7 @@ import Control.Monad ( zipWithM )
    44 44
     
    
    45 45
     This module does coercion optimisation.  See the paper
    
    46 46
     
    
    47
    -   Evidence normalization in Systtem FV (RTA'13)
    
    47
    +   Evidence normalization in System FV (RTA'13)
    
    48 48
        https://simon.peytonjones.org/evidence-normalization/
    
    49 49
     
    
    50 50
     The paper is also in the GHC repo, in docs/opt-coercion.
    

  • compiler/GHC/Tc/Gen/App.hs
    ... ... @@ -48,7 +48,6 @@ import GHC.Builtin.PrimOps( tagToEnumKey )
    48 48
     import GHC.Builtin.KnownKeys
    
    49 49
     
    
    50 50
     import GHC.Types.Var
    
    51
    -import GHC.Types.Var.FV
    
    52 51
     import GHC.Types.Name
    
    53 52
     import GHC.Types.Name.Env
    
    54 53
     import GHC.Types.Name.Reader
    
    ... ... @@ -2117,6 +2116,8 @@ anyFreeKappa :: TcType -> TcM Bool
    2117 2116
     -- See Note [The fiv test in quickLookArg]
    
    2118 2117
     anyFreeKappa ty = unTcMBool (foldQLInstVars go_tv ty)
    
    2119 2118
       where
    
    2119
    +    go_tv :: TcTyVar -> TcMBool
    
    2120
    +    -- `tv` is an instantiation variable
    
    2120 2121
         go_tv tv = TCMB $ do { info <- readMetaTyVar tv
    
    2121 2122
                              ; case info of
    
    2122 2123
                                  Indirect ty -> anyFreeKappa ty
    
    ... ... @@ -2129,13 +2130,15 @@ instance Monoid TcMBool where
    2129 2130
       mempty = TCMB (return False)
    
    2130 2131
     
    
    2131 2132
     foldQLInstVars :: forall a. Monoid a => (TcTyVar -> a) -> TcType -> a
    
    2133
    +-- Given (foldQLInstVars p ty), find all the free shallow instantiation
    
    2134
    +-- variables, apply `p` to them, and combine with `mappend`.
    
    2132 2135
     {-# INLINE foldQLInstVars #-}
    
    2133 2136
     foldQLInstVars check_tv ty
    
    2134
    -  = runFV (do_ty ty) ()
    
    2137
    +  = do_ty ty
    
    2135 2138
       where
    
    2136 2139
         (do_ty, _, _, _) = foldTyCo folder
    
    2137 2140
     
    
    2138
    -    folder :: TyCoFolder (FV () a)
    
    2141
    +    folder :: TyCoFolder a
    
    2139 2142
         folder = TyCoFolder { tcf_view = noView  -- See Note [Free vars and synonyms]
    
    2140 2143
                                                  -- in GHC.Core.TyCo.FVs
    
    2141 2144
                             , tcf_tyvar = do_tv, tcf_covar = mempty
    
    ... ... @@ -2146,8 +2149,8 @@ foldQLInstVars check_tv ty
    2146 2149
         do_hole hole = do_ty (coVarKind (coHoleCoVar hole))
    
    2147 2150
                          -- See (MIV2) in Note [Monomorphise instantiation variables]
    
    2148 2151
     
    
    2149
    -    do_tv :: TcTyVar -> FV () a
    
    2150
    -    do_tv tv | isQLInstTyVar tv = MkFV $ \_ -> check_tv tv
    
    2152
    +    do_tv :: TcTyVar -> a
    
    2153
    +    do_tv tv | isQLInstTyVar tv = check_tv tv
    
    2151 2154
                  | otherwise        = mempty
    
    2152 2155
     
    
    2153 2156
     {- *********************************************************************