Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/MicroCabal/Normalize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ libName (Cabal (g@(Section _ _ gs):ss)) = Cabal $ g : map set ss
reduce :: FlagInfo -> Cabal -> Cabal
reduce info c = reduce' (addFlags c) c
where addFlags (Cabal ss) = info{ flags = flags info ++ concatMap sect ss }
sect (Section "flag" n fs) = [(n', dflt n' fs)] where n' = map toLower n
sect (Section "flag" n fs) = [(map toLower n, dflt fs)]
sect _ = []
dflt n fs = head $ [ b | Field "default" (VBool b) <- fs ] ++ [error $ "no default for flag " ++ show n]
dflt fs = head $ [ b | Field "default" (VBool b) <- fs ] ++ [True]

reduce' :: FlagInfo -> Cabal -> Cabal
reduce' info = mapField red
Expand Down
7 changes: 4 additions & 3 deletions src/MicroCabal/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -440,20 +440,21 @@ parsers =
, "name" # (VItem <$> pItem)
, "package-url" # (VItem <$> pItem)
, "stability" # pFreeText
, "subdir" # (VItem <$> pItem)
, "synopsis" # pFreeTextX
, "tested-with" # pVLibs
, "version" # (VVersion <$> pVersion)
-- test suite fields
, "main-is" # (VItem <$> pItem)
, "test-module" # (VItem <$> pItem)
, "type" # (VItem <$> pItem)
-- source-repository fields
, "location" # (VItem <$> pItem)
, "module" # (VItem <$> pItem)
, "branch" # (VItem <$> pItem)
, "tag" # (VItem <$> pItem)
, "subdir" # (VItem <$> pItem)
-- flag fields
, "manual" # (VBool <$> pBoolNL)
, "default" # (VBool <$> pBoolNL)
, "tag" # pFreeText
]
where ( # ) = (,)
-- XXX use local fixity
Expand Down
Loading