shithub: MicroHs

Download patch

ref: b608e6dfa782ae98d4bb8f5bdcacd6410e7c9ab3
parent: 8550d88e9a32963637f0e15becb6ec4ed13fdba6
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Sun Mar 10 18:09:30 EDT 2024

Add choice.

--- a/src/Text/ParserComb.hs
+++ b/src/Text/ParserComb.hs
@@ -6,7 +6,7 @@
   Prsr, runPrsr,
   satisfy, satisfyM,
   satisfyMany,
-  --choice,
+  choice,
   many, emany, optional, eoptional,
   some, esome,
   esepBy, sepBy1, esepBy1,
@@ -185,11 +185,9 @@
 eoptional :: forall tm t a . Prsr tm t a -> Prsr tm t (Maybe a)
 eoptional p = (Just <$> p) <|< pure Nothing
 
-{-
 choice :: forall tm t a . TokenMachine tm t => [Prsr tm t a] -> Prsr tm t a
 choice [] = empty
 choice ps = foldr1 (<|>) ps
--}
 
 sepBy1 :: forall tm t a sep . TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]
 sepBy1 p sep = (:) <$> p <*> many (sep *> p)
--