Commit bba80735 authored by nominolo@gmail.com's avatar nominolo@gmail.com
Browse files

Allow lower-case spellings for boolean fields.

parent 39c03860
......@@ -182,7 +182,7 @@ executableFieldDescrs =
binfoFieldDescrs :: [FieldDescr BuildInfo]
binfoFieldDescrs =
[ simpleField "buildable"
(text . show) parseReadS
(text . show) parseBool
buildable (\val binfo -> binfo{buildable=val})
, commaListField "build-tools"
showDependency parseBuildTool
......@@ -253,7 +253,7 @@ flagFieldDescrs =
showFreeText (munch (const True))
flagDescription (\val fl -> fl{ flagDescription = val })
, simpleField "default"
(text . show) parseReadS
(text . show) parseBool
flagDefault (\val fl -> fl{ flagDefault = val })
]
......
......@@ -59,7 +59,7 @@ module Distribution.ParseUtils (
parseSepList, parseCommaList, parseOptCommaList,
showFilePath, showToken, showTestedWith, showDependency, showFreeText,
field, simpleField, listField, commaListField, optsField, liftField,
parseReadS, parseReadSQ, parseQuoted,
parseReadS, parseReadSQ, parseQuoted, parseBool
) where
import Distribution.Compiler (CompilerFlavor)
......@@ -477,6 +477,10 @@ parseFilePathQ = parseTokenQ
parseReadS :: Read a => ReadP r a
parseReadS = readS_to_P reads
parseBool :: ReadP r Bool
parseBool = choice [ (string "true" <++ string "True") >> return True
, (string "false" <++ string "False") >> return False ]
parseBuildTool :: ReadP r Dependency
parseBuildTool = do name <- parseBuildToolNameQ
skipSpaces
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment