Skip to content

Commit d09d0dd

Browse files
Merge branch 'master' into speedup-map-generation
2 parents 653ede3 + d203746 commit d09d0dd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Constrained/AbstractSyntax.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ runTermE env = \case
104104
V v -> case Env.lookup env v of
105105
Just a -> Right a
106106
Nothing -> Left (pure ("Couldn't find " ++ show v ++ " in " ++ show env))
107+
-- The first two cases here are an optimization to avoid dispatching to `mapMList` (which does all sorts of
108+
-- unpacking and packing and doesn't fuse nicely with `uncurryList_`)
109+
App f (ta :> Nil) -> semantics f <$> runTermE env ta
110+
App f (ta :> tb :> Nil) -> semantics f <$> runTermE env ta <*> runTermE env tb
107111
App f ts -> do
108112
vs <- mapMList (fmap Identity . runTermE env) ts
109113
pure $ uncurryList_ runIdentity (semantics f) vs

0 commit comments

Comments
 (0)