[commit: ghc] wip/T9858-typeable-ben: Unify: Add runUM for debugging purposes (ef0a4f7)
git at git.haskell.org
git at git.haskell.org
Wed Oct 28 10:46:34 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T9858-typeable-ben
Link : http://ghc.haskell.org/trac/ghc/changeset/ef0a4f7203af38feb355e2f3f60f8ede029fce29/ghc
>---------------------------------------------------------------
commit ef0a4f7203af38feb355e2f3f60f8ede029fce29
Author: Ben Gamari <ben at smart-cactus.org>
Date: Wed Oct 28 11:42:09 2015 +0100
Unify: Add runUM for debugging purposes
>---------------------------------------------------------------
ef0a4f7203af38feb355e2f3f60f8ede029fce29
compiler/types/Unify.hs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs
index 7f28bed..2ee3758 100644
--- a/compiler/types/Unify.hs
+++ b/compiler/types/Unify.hs
@@ -733,6 +733,13 @@ instance Monad UM where
initUM :: (TyVar -> BindFlag) -> UM () -> UnifyResult
initUM badtvs um = fmap (niFixTvSubst . snd) $ unUM um badtvs emptyTvSubstEnv
+-- | Run a 'UM' action without affecting the substition environment, returning the
+-- 'UnifyResultM' that the action concludes with.
+--
+-- For debugging purposes to peer into the decisions that the typechecker makes
+runUM :: UM a -> UM (UnifyResultM (a, TvSubstEnv))
+runUM um = UM $ \tv_fn subst -> Unifiable $ (unUM um tv_fn subst, subst)
+
tvBindFlag :: TyVar -> UM BindFlag
tvBindFlag tv = UM (\tv_fn subst -> Unifiable (tv_fn tv, subst))
More information about the ghc-commits
mailing list