From f0a97e1955f0254a5adcb60cd2035f60bf67bcbb Mon Sep 17 00:00:00 2001 From: Olle Fredriksson Date: Tue, 2 Jan 2024 22:16:25 +0100 Subject: [PATCH] Remove redundant money --- src/Elaboration/Context.hs | 10 +++------- src/Elaboration/Unification/Indices.hs | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Elaboration/Context.hs b/src/Elaboration/Context.hs index ba4f06e..61cdd3e 100644 --- a/src/Elaboration/Context.hs +++ b/src/Elaboration/Context.hs @@ -162,7 +162,7 @@ extendSurface context name@(Name.Surface nameText) type_ = do pure ( context { surfaceNames = HashMap.insert name (Domain.var var, type_) context.surfaceNames - , varNames = EnumMap.insert var (Name nameText) $ context.varNames + , varNames = EnumMap.insert var (Name nameText) context.varNames , indices = context.indices Index.Map.:> var , types = EnumMap.insert var type_ context.types , boundVars = context.boundVars IntSeq.:> var @@ -266,14 +266,10 @@ skip context = do define :: Context v -> Var -> Domain.Value -> M (Context v) define context var value = do deps <- evalStateT (dependencies context value) mempty - let context' = - defineWellOrdered context var value - + let context' = defineWellOrdered context var value (pre, post) = Tsil.partition (`EnumSet.member` deps) $ - IntSeq.toTsil $ - context'.boundVars - + IntSeq.toTsil context'.boundVars pure context' { boundVars = diff --git a/src/Elaboration/Unification/Indices.hs b/src/Elaboration/Unification/Indices.hs index 75ad018..30f4693 100644 --- a/src/Elaboration/Unification/Indices.hs +++ b/src/Elaboration/Unification/Indices.hs @@ -66,10 +66,10 @@ isTouchable var = do extend :: Name -> Domain.Type -> (Var -> Unify (Succ v) a) -> Unify v a extend name type_ k = do st <- get - (result, st') <- lift $ do + (result, st') <- lift do (context', var) <- Context.extend st.context name type_ runStateT (k var) st {context = context', touchableBefore = Index.Succ st.touchableBefore} - put st' {context = unextend $ st'.context, touchableBefore = st.touchableBefore} + put st' {context = unextend st'.context, touchableBefore = st.touchableBefore} pure result unextend :: Context (Succ v) -> Context v