From 8bc73de30d4d9e1d2dd7916b95b2dcd4fc5cab89 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 9 Mar 2023 23:14:48 +0100 Subject: Improve parsers of 2020-02 --- 2020/02-Password_Philosophy/first.hs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to '2020/02-Password_Philosophy/first.hs') diff --git a/2020/02-Password_Philosophy/first.hs b/2020/02-Password_Philosophy/first.hs index 85c092e..4fd60b5 100644 --- a/2020/02-Password_Philosophy/first.hs +++ b/2020/02-Password_Philosophy/first.hs @@ -25,15 +25,12 @@ parseRule = do void (char ' ') e <- anySingle void (string ": ") - pass <- (many letterChar) + pass <- (some letterChar) void (char '\n') return Rule { lower = read l, higher = read h, elt = e, pass = pass } parseRules :: Parser [Rule] -parseRules = do - rules <- many parseRule - eof - return rules +parseRules = some parseRule <* eof parseInput :: String -> IO [Rule] parseInput filename = do -- cgit v1.2.3