diff options
author | Ben Gamari <ben@smart-cactus.org> | 2015-10-28 11:42:09 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-10-28 11:42:09 +0100 |
commit | ef0a4f7203af38feb355e2f3f60f8ede029fce29 (patch) | |
tree | c0acf663c610143ea24edefdac1f40e4f9c2afc1 | |
parent | e50c0106fbd2d4ffcc659d77265245c029951279 (diff) | |
download | haskell-ef0a4f7203af38feb355e2f3f60f8ede029fce29.tar.gz |
Unify: Add runUM for debugging purposes
-rw-r--r-- | compiler/types/Unify.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index 7f28bed0b4..2ee375884b 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)) |