[Git][ghc/ghc][wip/T16762] More wibbles

Simon Peyton Jones gitlab at gitlab.haskell.org
Wed Oct 28 17:35:21 UTC 2020



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


Commits:
9ffdc4d9 by Simon Peyton Jones at 2020-10-28T17:34:46+00:00
More wibbles

- - - - -


2 changed files:

- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Utils/Monad.hs


Changes:

=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -3003,7 +3003,7 @@ bindOuterFamEqnTKBndrs_Q_Tv :: HsOuterFamEqnTyVarBndrs GhcRn
                             -> TcM a
                             -> TcM ([TcTyVar], a)
 bindOuterFamEqnTKBndrs_Q_Tv hs_bndrs thing_inside
-  = applyToFstM getOuterTyVars $
+  = liftFstM getOuterTyVars $
     bindOuterTKBndrsX (smVanilla { sm_clone = False, sm_parent = True
                                  , sm_tvtv = True })
                       hs_bndrs thing_inside
@@ -3013,7 +3013,7 @@ bindOuterFamEqnTKBndrs :: HsOuterFamEqnTyVarBndrs GhcRn
                        -> TcM a
                        -> TcM ([TcTyVar], a)
 bindOuterFamEqnTKBndrs hs_bndrs thing_inside
-  = applyToFstM getOuterTyVars $
+  = liftFstM getOuterTyVars $
     bindOuterTKBndrsX (smVanilla { sm_clone = False, sm_parent = True })
                       hs_bndrs thing_inside
     -- sm_clone=False: see Note [Cloning for type variable binders]
@@ -3096,14 +3096,14 @@ bindExplicitTKBndrs_Q_Skol, bindExplicitTKBndrs_Q_Tv
     -> TcM ([TcTyVar], a)
 -- These do not clone: see Note [Cloning for type variable binders]
 bindExplicitTKBndrs_Q_Skol ctxt_kind hs_bndrs thing_inside
-  = applyToFstM binderVars $
+  = liftFstM binderVars $
     bindExplicitTKBndrsX (smVanilla { sm_clone = False, sm_parent = True
                                     , sm_kind = ctxt_kind })
                          hs_bndrs thing_inside
     -- sm_clone=False: see Note [Cloning for type variable binders]
 
 bindExplicitTKBndrs_Q_Tv ctxt_kind hs_bndrs thing_inside
-  = applyToFstM binderVars $
+  = liftFstM binderVars $
     bindExplicitTKBndrsX (smVanilla { sm_clone = False, sm_parent = True
                                     , sm_tvtv = True, sm_kind = ctxt_kind })
                          hs_bndrs thing_inside
@@ -3118,7 +3118,7 @@ bindExplicitTKBndrsX :: (OutputableBndrFlag flag)
 bindExplicitTKBndrsX skol_mode@(SM { sm_parent = check_parent, sm_kind = ctxt_kind
                                    , sm_holes = hole_info })
                      hs_tvs thing_inside
-  = do { traceTc "bindExplicTKBndrs" (ppr hs_tvs)
+  = do { traceTc "bindExplicitTKBndrs" (ppr hs_tvs)
        ; go hs_tvs }
   where
     tc_ki_mode = TcTyMode { mode_tyki = KindLevel, mode_holes = hole_info }
@@ -3232,7 +3232,7 @@ bindImplicitTKBndrsX skol_mode@(SM { sm_parent = check_parent, sm_kind = ctxt_ki
 --           SkolemMode
 --------------------------------------
 
--- | 'SkolemMode' decribes how to typecheck an explict ('HsTyVarBndr') or
+-- | 'SkolemMode' decribes how to typecheck an explicit ('HsTyVarBndr') or
 -- implicit ('Name') binder in a type. It is just a record of flags
 -- that describe what sort of 'TcTyVar' to create.
 data SkolemMode
@@ -3283,15 +3283,15 @@ When we /must not/ clone
   (in tcDataFamInstDecl) bring p,q into scope before looking at the
   the constructor decls.
 
-* bindExplictTKBndrs_Q_Tv/bindImplicitTKBndrs_Q_Tv do not clone
+* bindExplicitTKBndrs_Q_Tv/bindImplicitTKBndrs_Q_Tv do not clone
   We take advantage of this in kcInferDeclHeader:
      all_tv_prs = mkTyVarNamePairs (scoped_kvs ++ tc_tvs)
   If we cloned, we'd need to take a bit more care here; not hard.
 
-* bindExplictTKBndrs_Q_Skol, bindExplictTKBndrs_Skol, do not clone.
+* bindExplicitTKBndrs_Q_Skol, bindExplicitTKBndrs_Skol, do not clone.
   There is no need, I think.
 
-  The payoff here is that avoiding gratuitious cloning means that we can
+  The payoff here is that avoiding gratuitous cloning means that we can
   almost always take the fast path in swizzleTcTyConBndrs.
 
 When we /must/ clone.


=====================================
compiler/GHC/Utils/Monad.hs
=====================================
@@ -11,7 +11,7 @@ module GHC.Utils.Monad
         , zipWith3M, zipWith3M_, zipWith4M, zipWithAndUnzipM
         , mapAndUnzipM, mapAndUnzip3M, mapAndUnzip4M, mapAndUnzip5M
         , mapAccumLM
-        , applyToFstM, applyToSndM
+        , liftFstM, liftSndM
         , mapSndM
         , concatMapM
         , mapMaybeM
@@ -165,11 +165,11 @@ mapSndM f xs = go xs
     go []         = return []
     go ((a,b):xs) = do { c <- f b; rs <- go xs; return ((a,c):rs) }
 
-applyToFstM :: Monad m => (a -> b) -> m (a, r) -> m (b, r)
-applyToFstM f thing = do { (a,r) <- thing; return (f a, r) }
+liftFstM :: Monad m => (a -> b) -> m (a, r) -> m (b, r)
+liftFstM f thing = do { (a,r) <- thing; return (f a, r) }
 
-applyToSndM :: Monad m => (a -> b) -> m (r, a) -> m (r, b)
-applyToSndM f thing = do { (r,a) <- thing; return (r, f a) }
+liftSndM :: Monad m => (a -> b) -> m (r, a) -> m (r, b)
+liftSndM f thing = do { (r,a) <- thing; return (r, f a) }
 
 -- | Monadic version of concatMap
 concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9ffdc4d9ffc595882ba5398634ca37a2bf4a307d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9ffdc4d9ffc595882ba5398634ca37a2bf4a307d
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/20201028/509325c7/attachment-0001.html>


More information about the ghc-commits mailing list