Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Constrained/AbstractSyntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ runTermE env = \case
V v -> case Env.lookup env v of
Just a -> Right a
Nothing -> Left (pure ("Couldn't find " ++ show v ++ " in " ++ show env))
-- The first two cases here are an optimization to avoid dispatching to `mapMList` (which does all sorts of
-- unpacking and packing and doesn't fuse nicely with `uncurryList_`)
App f (ta :> Nil) -> semantics f <$> runTermE env ta
App f (ta :> tb :> Nil) -> semantics f <$> runTermE env ta <*> runTermE env tb
App f ts -> do
vs <- mapMList (fmap Identity . runTermE env) ts
pure $ uncurryList_ runIdentity (semantics f) vs
Expand Down
Loading