Commit 8a246551 authored by Robert Henderson's avatar Robert Henderson

Code cleanup: removed duplicated versions of 'showStanza'.

parent 3db6e93e
......@@ -695,9 +695,7 @@ printPlan dryRun verbosity plan sourcePkgDb = case plan of
in confPkgFlags cpkg \\ defaultAssignment
showStanzas :: [OptionalStanza] -> String
showStanzas = concatMap ((' ' :) . showStanza)
showStanza TestStanzas = "*test"
showStanza BenchStanzas = "*bench"
showStanzas = concatMap ((" *" ++) . showStanza)
showFlagAssignment :: FlagAssignment -> String
showFlagAssignment = concatMap ((' ' :) . showFlagValue)
......
......@@ -755,9 +755,7 @@ instance Text UserConstraint where
disp (UserConstraintStanzas pkgname stanzas) = disp pkgname
<+> dispStanzas stanzas
where
dispStanzas = Disp.hsep . map dispStanza
dispStanza TestStanzas = Disp.text "test"
dispStanza BenchStanzas = Disp.text "bench"
dispStanzas = Disp.hsep . map (Disp.text . showStanza)
parse = parse >>= parseConstraint
where
......
......@@ -71,10 +71,6 @@ type QSN = SN QPN
newtype WeakOrTrivial = WeakOrTrivial { unWeakOrTrivial :: Bool }
deriving (Eq, Ord, Show)
unStanza :: OptionalStanza -> String
unStanza TestStanzas = "test"
unStanza BenchStanzas = "bench"
showQFNBool :: QFN -> Bool -> String
showQFNBool qfn@(FN pi _f) b = showPI pi ++ ":" ++ showFBool qfn b
......@@ -85,11 +81,11 @@ showFBool :: FN qpn -> Bool -> String
showFBool (FN _ f) v = showFlagValue (f, v)
showSBool :: SN qpn -> Bool -> String
showSBool (SN _ s) True = "*" ++ unStanza s
showSBool (SN _ s) False = "!" ++ unStanza s
showSBool (SN _ s) True = "*" ++ showStanza s
showSBool (SN _ s) False = "!" ++ showStanza s
showQFN :: QFN -> String
showQFN (FN pi f) = showPI pi ++ ":" ++ unFlag f
showQSN :: QSN -> String
showQSN (SN pi f) = showPI pi ++ ":" ++ unStanza f
showQSN (SN pi f) = showPI pi ++ ":" ++ showStanza f
......@@ -2,6 +2,7 @@
{-# LANGUAGE DeriveDataTypeable #-}
module Distribution.Solver.Types.OptionalStanza
( OptionalStanza(..)
, showStanza
, enableStanzas
) where
......@@ -17,6 +18,11 @@ data OptionalStanza
| BenchStanzas
deriving (Eq, Ord, Enum, Bounded, Show, Generic, Typeable)
-- | String representation of an OptionalStanza.
showStanza :: OptionalStanza -> String
showStanza TestStanzas = "test"
showStanza BenchStanzas = "bench"
-- | Convert a list of 'OptionalStanza' into the corresponding
-- 'ComponentRequestedSpec' which records what components are enabled.
enableStanzas :: [OptionalStanza] -> ComponentRequestedSpec
......
......@@ -44,6 +44,3 @@ showPackageConstraint (PackageConstraintFlags pn fs) =
showFlag f False = "-" ++ unFlagName f
showPackageConstraint (PackageConstraintStanzas pn ss) =
"stanzas " ++ display pn ++ " " ++ unwords (map showStanza ss)
where
showStanza TestStanzas = "test"
showStanza BenchStanzas = "bench"
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