Skip to content

Commit

Permalink
Remove redundant money
Browse files Browse the repository at this point in the history
  • Loading branch information
ollef committed Jan 5, 2024
1 parent b8b3294 commit f0a97e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/Elaboration/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
4 changes: 2 additions & 2 deletions src/Elaboration/Unification/Indices.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f0a97e1

Please sign in to comment.