Commit 174d3a53 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Small refactor of TcMType.tauifyExpType

Mainly to make it clearer that tauifyExpType
is a no-op on (Check ty)
parent bdd90426
...@@ -393,14 +393,18 @@ checkingExpType err et = pprPanic "checkingExpType" (text err $$ ppr et) ...@@ -393,14 +393,18 @@ checkingExpType err et = pprPanic "checkingExpType" (text err $$ ppr et)
tauifyExpType :: ExpType -> TcM ExpType tauifyExpType :: ExpType -> TcM ExpType
-- ^ Turn a (Infer hole) type into a (Check alpha), -- ^ Turn a (Infer hole) type into a (Check alpha),
-- where alpha is a fresh unificaiton variable -- where alpha is a fresh unificaiton variable
tauifyExpType exp_ty = do { ty <- expTypeToType exp_ty tauifyExpType (Check ty) = return (Check ty) -- No-op for (Check ty)
; return (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 -- | Extracts the expected type if there is one, or generates a new
-- TauTv if there isn't. -- TauTv if there isn't.
expTypeToType :: ExpType -> TcM TcType expTypeToType :: ExpType -> TcM TcType
expTypeToType (Check ty) = return ty expTypeToType (Check ty) = return ty
expTypeToType (Infer u tc_lvl ki ref) 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 = do { uniq <- newUnique
; tv_ref <- newMutVar Flexi ; tv_ref <- newMutVar Flexi
; let details = MetaTv { mtv_info = TauTv ; let details = MetaTv { mtv_info = TauTv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment