From cb75a9bd417f48105c84e6dc03fe1e94cb8f2eb7 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 17 Aug 2017 16:58:34 -0400 Subject: [PATCH] Merge the atEnd cases. --- src/Data/Syntax/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Syntax/Assignment.hs b/src/Data/Syntax/Assignment.hs index 9fd45591c..b7eb40bb5 100644 --- a/src/Data/Syntax/Assignment.hs +++ b/src/Data/Syntax/Assignment.hs @@ -337,7 +337,7 @@ instance (Eq grammar, Eq (ast (AST ast grammar))) => Alternative (Assignment ast (_, Alt rs) -> rebuild (Alt (pure l <> (continueR <$> rs))) id _ | Just (sl, cl) <- choices l , Just (sr, cr) <- choices r - -> rebuild (Choose (sl `union` sr) (IntMap.unionWith (<|>) cl cr) (atEnd l <|> atEnd r)) id + -> rebuild (Choose (sl `union` sr) (IntMap.unionWith (<|>) cl cr) ((<|>) <$> atEnd l <*> atEnd r)) id | otherwise -> rebuild (Alt [l, r]) id where distribute :: (l ~ lr, r ~ lr) => AssignmentF ast grammar lr -> Assignment ast grammar a distribute a = rebuild a (uncurry (<|>) . (continueL &&& continueR))