Return the unification state from runUnifyT.

This commit is contained in:
Danila Fedorin 2023-03-04 14:52:00 -08:00
parent 1f93dc1745
commit e45201ba45

View File

@ -18,7 +18,7 @@ import Data.Foldable (any, foldr)
import Data.Map (Map, lookup, insert)
import Data.Map as Map
import Data.Set (Set, singleton, union)
import Data.Tuple (Tuple(..), fst)
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Newtype (class Newtype, un)
import Data.Maybe (Maybe(..), fromMaybe, isJust)
@ -79,5 +79,5 @@ instance (Unifiable k f, MonadPlus m) => MonadUnify k f (UnifyT k f m) where
process k = fromMaybe (variable k) (reify' <$> (lookup k boundVariables >>= _.boundTo))
pure $ reify' f
runUnifyT :: forall k f m a. Monad m => UnificationVariable k => UnifyT k f m a -> m a
runUnifyT m = fst <$> runStateT (un MkUnifyT m) { boundVariables: Map.empty, currentVariables: variables }
runUnifyT :: forall k f m a. Monad m => UnificationVariable k => UnifyT k f m a -> m (Tuple a (UnificationState k f))
runUnifyT m = runStateT (un MkUnifyT m) { boundVariables: Map.empty, currentVariables: variables }