diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-03-30 17:19:51 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-03-31 08:04:07 +0100 |
commit | 174d3a53c7a6a60277adae0f4aee2407b03d6f44 (patch) | |
tree | 145734e1880c9bf8ad17dffc01aaecd724ebf6e9 | |
parent | bdd90426a7f88d57bedf15411fa00f62aeb22172 (diff) | |
download | haskell-174d3a53c7a6a60277adae0f4aee2407b03d6f44.tar.gz |
Small refactor of TcMType.tauifyExpType
Mainly to make it clearer that tauifyExpType
is a no-op on (Check ty)
-rw-r--r-- | compiler/typecheck/TcMType.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index cb9ed723ba..296f88cd81 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 |