1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

Simplify the Copy case.

This commit is contained in:
Rob Rix 2017-09-10 17:43:35 +01:00
parent dbc79d8ab0
commit ebcaa3fb27

View File

@ -65,10 +65,7 @@ evalDiffR algebra = flip go mempty
evalDiffRM :: (Functor syntax, Reader (Env (Diff syntax ann, Eff fs a)) :< fs) => (DiffF syntax ann (Diff syntax ann, Eff fs a) -> Eff fs a) -> Diff syntax ann -> Eff fs a evalDiffRM :: (Functor syntax, Reader (Env (Diff syntax ann, Eff fs a)) :< fs) => (DiffF syntax ann (Diff syntax ann, Eff fs a) -> Eff fs a) -> Diff syntax ann -> Eff fs a
evalDiffRM algebra = go evalDiffRM algebra = go
where go = para $ \ diff -> case diff of where go = para $ \ diff -> case diff of
Copy bindings ann syntax -> do Copy bindings _ _ -> local (flip (foldr (uncurry envExtend)) bindings) (algebra diff)
env <- ask
let extended = foldr (uncurry envExtend) env bindings
local (const extended) $ algebra (Copy bindings ann syntax)
_ -> algebra diff _ -> algebra diff