Skip to content

Commit 1e9b885

Browse files
committed
feat: add on/off to booleans
1 parent 028f1c0 commit 1e9b885

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Text/Megaparsec/Utils.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ import Text.Megaparsec.Char (
5151
)
5252
import Text.Read (readMaybe)
5353

54-
-- | Parse a case-insensitive human-readable boolean, including C-style numbers
55-
-- and English yes-no.
54+
-- | Parse a case-insensitive human-readable boolean, including C-style numbers,
55+
-- English yes-no and @on@ / @off@.
5656
boolParser
5757
:: Ord e
5858
=> Parsec e String Bool
5959
boolParser = true <|> false
6060
where
61-
true = True <$ choice (map string' ["true", "y", "yes", "1"])
62-
false = False <$ choice (map string' ["false", "n", "no", "0"])
61+
true = True <$ choice (map string' ["true", "y", "yes", "on", "1"])
62+
false = False <$ choice (map string' ["false", "n", "no", "off", "0"])
6363

6464
-- | Parse a 'Bounded' 'Enum' type that has a 'Show' instance, trying all
6565
-- possibilities, case-insensitive, in the 'Enum' order.

0 commit comments

Comments
 (0)