[commit: ghc] master: Small refactor of TcMType.tauifyExpType (174d3a5)

git at git.haskell.org git at git.haskell.org
Thu Mar 31 07:01:57 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/174d3a53c7a6a60277adae0f4aee2407b03d6f44/ghc

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

commit 174d3a53c7a6a60277adae0f4aee2407b03d6f44
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Mar 30 17:19:51 2016 +0100

    Small refactor of TcMType.tauifyExpType
    
    Mainly to make it clearer that tauifyExpType
    is a no-op on (Check ty)


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

174d3a53c7a6a60277adae0f4aee2407b03d6f44
 compiler/typecheck/TcMType.hs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index cb9ed72..296f88c 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -393,14 +393,18 @@ checkingExpType err et         = pprPanic "checkingExpType" (text err $$ ppr et)
 tauifyExpType :: ExpType -> TcM ExpType
 -- ^ Turn a (Infer hole) type into a (Check alpha),
 -- where alpha is a fresh unificaiton variable
-tauifyExpType exp_ty = do { ty <- expTypeToType exp_ty
-                          ; return (Check ty) }
+tauifyExpType (Check ty)              = return (Check ty)  -- No-op for (Check ty)
+tauifyExpType (Infer u tc_lvl ki ref) = do { ty <- inferTypeToType u tc_lvl ki ref
+                                           ; return (Check ty) }
 
 -- | Extracts the expected type if there is one, or generates a new
 -- TauTv if there isn't.
 expTypeToType :: ExpType -> TcM TcType
-expTypeToType (Check ty) = return ty
-expTypeToType (Infer u tc_lvl ki ref)
+expTypeToType (Check ty)              = return ty
+expTypeToType (Infer u tc_lvl ki ref) = inferTypeToType u tc_lvl ki ref
+
+inferTypeToType :: Unique -> TcLevel -> Kind -> IORef (Maybe TcType) -> TcM Type
+inferTypeToType u tc_lvl ki ref
   = do { uniq <- newUnique
        ; tv_ref <- newMutVar Flexi
        ; let details = MetaTv { mtv_info = TauTv



More information about the ghc-commits mailing list