shithub: MicroHs

Download patch

ref: 9b17d0e04d1e7158a3c5328f92f96ad01677399e
parent: 54a1b4925158ebcdf9f5d8656ceaea76122c1dc1
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Tue Feb 27 17:08:51 EST 2024

Small efficiency improvement.

--- a/src/Text/ParserComb.hs
+++ b/src/Text/ParserComb.hs
@@ -92,9 +92,9 @@
     case runP p t of
       Many aus plf ->
         let ms = map (\ (a, u) -> runP (k a) u) aus
-            rss = map (\ (Many rs _) -> rs) ms
             lfs = map (\ (Many _ lf) -> lf) ms
-        in  Many (concat rss) (longests (plf : lfs))
+            rrs = [ r | Many rs _ <- ms, r <- rs ]
+        in  Many rrs (longests (plf : lfs))
   return = pure
 
 instance forall s t tm . TokenMachine tm t => MonadFail (Prsr s tm t) where
--