Distribution.Types.Condition

Cabal-syntax-3.11.0.0: A library for working with .cabal files

Safe Haskell | Safe-Inferred
Language | Haskell2010

Distribution.Types.Condition

Synopsis

- data Condition c
  - = Var c
  - | Lit Bool
  - | CNot (Condition c)
  - | COr (Condition c) (Condition c)
  - | CAnd (Condition c) (Condition c)
- cNot :: Condition a -> Condition a
- cAnd :: Condition a -> Condition a -> Condition a
- cOr :: Eq v => Condition v -> Condition v -> Condition v
- simplifyCondition :: Condition c -> (c -> Either d Bool) -> (Condition d, [d])

# Documentation

data Condition c Source #

A boolean expression parameterized over the variable type used.

Constructors

Var c |
Lit Bool |
CNot (Condition c) |
COr (Condition c) (Condition c) |
CAnd (Condition c) (Condition c) |

#### Instances

Instances details

Alternative Condition Source # |
Instance details Defined in Distribution.Types.Condition Methods empty :: Condition a # (<|>) :: Condition a -> Condition a -> Condition a # some :: Condition a -> Condition [a] # many :: Condition a -> Condition [a] #
Applicative Condition Source # |
Instance details Defined in Distribution.Types.Condition Methods pure :: a -> Condition a # (<*>) :: Condition (a -> b) -> Condition a -> Condition b # liftA2 :: (a -> b -> c) -> Condition a -> Condition b -> Condition c # (*>) :: Condition a -> Condition b -> Condition b # (<*) :: Condition a -> Condition b -> Condition a #
Functor Condition Source # |
Instance details Defined in Distribution.Types.Condition Methods fmap :: (a -> b) -> Condition a -> Condition b # (<$) :: a -> Condition b -> Condition a #
Monad Condition Source # |
Instance details Defined in Distribution.Types.Condition Methods (>>=) :: Condition a -> (a -> Condition b) -> Condition b # (>>) :: Condition a -> Condition b -> Condition b # return :: a -> Condition a #
MonadPlus Condition Source # |
Instance details Defined in Distribution.Types.Condition Methods mzero :: Condition a # mplus :: Condition a -> Condition a -> Condition a #
Foldable Condition Source # |
Instance details Defined in Distribution.Types.Condition Methods fold :: Monoid m => Condition m -> m # foldMap :: Monoid m => (a -> m) -> Condition a -> m # foldMap' :: Monoid m => (a -> m) -> Condition a -> m # foldr :: (a -> b -> b) -> b -> Condition a -> b # foldr' :: (a -> b -> b) -> b -> Condition a -> b # foldl :: (b -> a -> b) -> b -> Condition a -> b # foldl' :: (b -> a -> b) -> b -> Condition a -> b # foldr1 :: (a -> a -> a) -> Condition a -> a # foldl1 :: (a -> a -> a) -> Condition a -> a # toList :: Condition a -> [a] # null :: Condition a -> Bool # length :: Condition a -> Int # elem :: Eq a => a -> Condition a -> Bool # maximum :: Ord a => Condition a -> a # minimum :: Ord a => Condition a -> a # sum :: Num a => Condition a -> a # product :: Num a => Condition a -> a #
Traversable Condition Source # |
Instance details Defined in Distribution.Types.Condition Methods traverse :: Applicative f => (a -> f b) -> Condition a -> f (Condition b) # sequenceA :: Applicative f => Condition (f a) -> f (Condition a) # mapM :: Monad m => (a -> m b) -> Condition a -> m (Condition b) # sequence :: Monad m => Condition (m a) -> m (Condition a) #
Structured c => Structured (Condition c) Source # |
Instance details Defined in Distribution.Types.Condition Methods structure :: Proxy (Condition c) -> Structure Source # structureHash' :: Tagged (Condition c) MD5
Binary c => Binary (Condition c) Source # |
Instance details Defined in Distribution.Types.Condition Methods put :: Condition c -> Put Source # get :: Get (Condition c) Source # putList :: [Condition c] -> Put Source #
NFData c => NFData (Condition c) Source # |
Instance details Defined in Distribution.Types.Condition Methods rnf :: Condition c -> () Source #
Monoid (Condition a) Source # |
Instance details Defined in Distribution.Types.Condition Methods mempty :: Condition a # mappend :: Condition a -> Condition a -> Condition a # mconcat :: [Condition a] -> Condition a #
Semigroup (Condition a) Source # |
Instance details Defined in Distribution.Types.Condition Methods (<>) :: Condition a -> Condition a -> Condition a # sconcat :: NonEmpty (Condition a) -> Condition a # stimes :: Integral b => b -> Condition a -> Condition a #
Data c => Data (Condition c) Source # |
Instance details Defined in Distribution.Types.Condition Methods gfoldl :: (forall d b. Data d => c0 (d -> b) -> d -> c0 b) -> (forall g. g -> c0 g) -> Condition c -> c0 (Condition c) # gunfold :: (forall b r. Data b => c0 (b -> r) -> c0 r) -> (forall r. r -> c0 r) -> Constr -> c0 (Condition c) # toConstr :: Condition c -> Constr # dataTypeOf :: Condition c -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c0 (t d)) -> Maybe (c0 (Condition c)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c0 (t d e)) -> Maybe (c0 (Condition c)) # gmapT :: (forall b. Data b => b -> b) -> Condition c -> Condition c # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Condition c -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Condition c -> r # gmapQ :: (forall d. Data d => d -> u) -> Condition c -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Condition c -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Condition c -> m (Condition c) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Condition c -> m (Condition c) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Condition c -> m (Condition c) #
Generic (Condition c) Source # |
Instance details Defined in Distribution.Types.Condition Associated Types
type Rep (Condition c) |
Instance details Defined in Distribution.Types.Condition type Rep (Condition c) = D1 ('MetaData "Condition" "Distribution.Types.Condition" "Cabal-syntax-3.11.0.0-f9cc" 'False) ((C1 ('MetaCons "Var" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 c)) :+: C1 ('MetaCons "Lit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :+: (C1 ('MetaCons "CNot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c))) :+: (C1 ('MetaCons "COr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c))) :+: C1 ('MetaCons "CAnd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c))))))
Methods from :: Condition c -> Rep (Condition c) x # to :: Rep (Condition c) x -> Condition c #
Show c => Show (Condition c) Source # |
Instance details Defined in Distribution.Types.Condition Methods showsPrec :: Int -> Condition c -> ShowS # show :: Condition c -> String # showList :: [Condition c] -> ShowS #
Eq c => Eq (Condition c) Source # |
Instance details Defined in Distribution.Types.Condition Methods (==) :: Condition c -> Condition c -> Bool # (/=) :: Condition c -> Condition c -> Bool #
type Rep (Condition c) Source # |
Instance details Defined in Distribution.Types.Condition type Rep (Condition c) = D1 ('MetaData "Condition" "Distribution.Types.Condition" "Cabal-syntax-3.11.0.0-f9cc" 'False) ((C1 ('MetaCons "Var" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 c)) :+: C1 ('MetaCons "Lit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :+: (C1 ('MetaCons "CNot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c))) :+: (C1 ('MetaCons "COr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c))) :+: C1 ('MetaCons "CAnd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Condition c))))))

cNot :: Condition a -> Condition a Source #

Boolean negation of a `Condition` value.

cAnd :: Condition a -> Condition a -> Condition a Source #

Boolean AND of two `Condition` values.

cOr :: Eq v => Condition v -> Condition v -> Condition v Source #

Boolean OR of two `Condition` values.

simplifyCondition Source #

Arguments

:: Condition c |
-> (c -> Either d Bool) | (partial) variable assignment
-> (Condition d, [d]) |

Simplify the condition and return its free variables.