Copyright | Isaac Jones 2003-2004 Duncan Coutts 2007 |
---|---|
License | BSD3 |
Maintainer | cabal-devel@haskell.org |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Defines the Flag
type and it's Monoid
instance, see
http://www.haskell.org/pipermail/cabal-devel/2007-December/001509.html
for an explanation.
Split off from Distribution.Simple.Setup to break import cycles.
Synopsis
- data Flag a
- allFlags :: [Flag Bool] -> Flag Bool
- toFlag :: a -> Flag a
- fromFlag :: WithCallStack (Flag a -> a)
- fromFlagOrDefault :: a -> Flag a -> a
- flagToMaybe :: Flag a -> Maybe a
- flagToList :: Flag a -> [a]
- maybeToFlag :: Maybe a -> Flag a
- class BooleanFlag a where
Documentation
All flags are monoids, they come in two flavours:
- list flags eg
--ghc-option=foo --ghc-option=bar
gives us all the values ["foo", "bar"]
- singular value flags, eg:
--enable-foo --disable-foo
gives us Just False
So this Flag type is for the latter singular kind of flag.
Its monoid instance gives us the behaviour where it starts out as
NoFlag
and later flags override earlier ones.
Instances
Functor Flag # | |
Applicative Flag # | |
Bounded a => Bounded (Flag a) # | |
Enum a => Enum (Flag a) # | |
Defined in Distribution.Simple.Flag | |
Eq a => Eq (Flag a) # | |
Read a => Read (Flag a) # | |
Show a => Show (Flag a) # | |
Generic (Flag a) # | |
Semigroup (Flag a) # | |
Monoid (Flag a) # | |
Binary a => Binary (Flag a) # | |
type Rep (Flag a) # | |
Defined in Distribution.Simple.Flag type Rep (Flag a) = D1 (MetaData "Flag" "Distribution.Simple.Flag" "Cabal-2.4.0.1-4dDrY0nmi936kgccwkOPil" False) (C1 (MetaCons "Flag" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) :+: C1 (MetaCons "NoFlag" PrefixI False) (U1 :: * -> *)) |
fromFlag :: WithCallStack (Flag a -> a) #
fromFlagOrDefault :: a -> Flag a -> a #
flagToMaybe :: Flag a -> Maybe a #
flagToList :: Flag a -> [a] #
maybeToFlag :: Maybe a -> Flag a #
class BooleanFlag a where #
Types that represent boolean flags.
Instances
BooleanFlag Bool # | |
Defined in Distribution.Simple.Flag |