1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +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 algebra = go
where go = para $ \ diff -> case diff of
Copy bindings ann syntax -> do
env <- ask
let extended = foldr (uncurry envExtend) env bindings
local (const extended) $ algebra (Copy bindings ann syntax)
Copy bindings _ _ -> local (flip (foldr (uncurry envExtend)) bindings) (algebra diff)
_ -> algebra diff