diff --git a/Cabal/src/Distribution/Simple/Flag.hs b/Cabal/src/Distribution/Simple/Flag.hs index 671892aa96b..018a7288274 100644 --- a/Cabal/src/Distribution/Simple/Flag.hs +++ b/Cabal/src/Distribution/Simple/Flag.hs @@ -26,7 +26,6 @@ module Distribution.Simple.Flag ( flagToMaybe, flagToList, maybeToFlag, - maybeStringToBoolFlag, BooleanFlag(..) ) where import Prelude () @@ -125,12 +124,6 @@ maybeToFlag :: Maybe a -> Flag a maybeToFlag Nothing = NoFlag maybeToFlag (Just x) = Flag x -maybeStringToBoolFlag :: Maybe String -> Flag Bool -maybeStringToBoolFlag Nothing = NoFlag -maybeStringToBoolFlag (Just "True") = Flag True -maybeStringToBoolFlag (Just "False") = Flag False -maybeStringToBoolFlag _ = NoFlag - -- | Types that represent boolean flags. class BooleanFlag a where asBool :: a -> Bool diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index ef73a17aebf..b4653f977b6 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -88,7 +88,7 @@ import Distribution.Simple.Configure import qualified Distribution.Simple.Setup as Cabal import Distribution.Simple.Flag ( Flag(..), toFlag, flagToMaybe, flagToList, maybeToFlag - , flagElim, fromFlagOrDefault, maybeStringToBoolFlag + , flagElim, fromFlagOrDefault ) import Distribution.Simple.Setup ( ConfigFlags(..), BuildFlags(..), ReplFlags @@ -364,7 +364,7 @@ globalCommand commands = CommandUI { ,multiOption "nix" globalNix (\v flags -> flags { globalNix = v }) [ - optArg' "(True or False)" maybeStringToBoolFlag (\case + optArg' "(True or False)" (maybeToFlag . (readMaybe =<<)) (\case Flag True -> [Just "enable"] Flag False -> [Just "disable"] NoFlag -> [Just "disable"]) "" ["nix"]