Skip to content

Commit 5036cc5

Browse files
committed
Add missing fields
Make default value of `default` `True'
1 parent 722c9ee commit 5036cc5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/MicroCabal/Normalize.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ libName (Cabal (g@(Section _ _ gs):ss)) = Cabal $ g : map set ss
5151
reduce :: FlagInfo -> Cabal -> Cabal
5252
reduce info c = reduce' (addFlags c) c
5353
where addFlags (Cabal ss) = info{ flags = flags info ++ concatMap sect ss }
54-
sect (Section "flag" n fs) = [(n', dflt n' fs)] where n' = map toLower n
54+
sect (Section "flag" n fs) = [(map toLower n, dflt fs)]
5555
sect _ = []
56-
dflt n fs = head $ [ b | Field "default" (VBool b) <- fs ] ++ [error $ "no default for flag " ++ show n]
56+
dflt fs = head $ [ b | Field "default" (VBool b) <- fs ] ++ [True]
5757

5858
reduce' :: FlagInfo -> Cabal -> Cabal
5959
reduce' info = mapField red

src/MicroCabal/Parse.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,20 +440,21 @@ parsers =
440440
, "name" # (VItem <$> pItem)
441441
, "package-url" # (VItem <$> pItem)
442442
, "stability" # pFreeText
443-
, "subdir" # (VItem <$> pItem)
444443
, "synopsis" # pFreeTextX
445444
, "tested-with" # pVLibs
446445
, "version" # (VVersion <$> pVersion)
447446
-- test suite fields
448447
, "main-is" # (VItem <$> pItem)
449448
, "test-module" # (VItem <$> pItem)
450-
, "type" # (VItem <$> pItem)
451449
-- source-repository fields
452450
, "location" # (VItem <$> pItem)
451+
, "module" # (VItem <$> pItem)
452+
, "branch" # (VItem <$> pItem)
453+
, "tag" # (VItem <$> pItem)
454+
, "subdir" # (VItem <$> pItem)
453455
-- flag fields
454456
, "manual" # (VBool <$> pBoolNL)
455457
, "default" # (VBool <$> pBoolNL)
456-
, "tag" # pFreeText
457458
]
458459
where ( # ) = (,)
459460
-- XXX use local fixity

0 commit comments

Comments
 (0)