| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Dojang.Types.EnvironmentPredicate
Description
A predicate expression that can be used to match an environment, e.g.,
And [OperatingSystem "linux", Architecture "x86_64"].
Synopsis
Documentation
data EnvironmentPredicate Source #
A predicate that can be used to match an environment.
Constructors
| Always | A predicate that always matches. |
| Not EnvironmentPredicate | A predicate that matches if the given predicate does not match. |
| And (NonEmpty EnvironmentPredicate) | A predicate that matches if all of the given predicates match. |
| Or (NonEmpty EnvironmentPredicate) | A predicate that matches if any of the given predicates match. |
| Moniker MonikerName | A predicate that matches to another moniker. Mostly used to eliminate duplication. |
| OperatingSystem OperatingSystem | A predicate that matches to the given operating system (e.g. |
| Architecture Architecture | A predicate that matches to the given architecture (e.g. |
| KernelName (CI Text) | A predicate that matches to the given kernel name (e.g. |
| KernelRelease (CI Text) | A predicate that exactly matches to the given kernel release
(e.g. |
| KernelReleasePrefix (CI Text) | A predicate that matches to the given kernel release prefix
(e.g. |
| KernelReleaseSuffix (CI Text) | A predicate that matches to the given kernel release suffix
(e.g. |
Instances
| Show EnvironmentPredicate Source # | |
Defined in Dojang.Types.EnvironmentPredicate Methods showsPrec :: Int -> EnvironmentPredicate -> ShowS # show :: EnvironmentPredicate -> String # showList :: [EnvironmentPredicate] -> ShowS # | |
| Eq EnvironmentPredicate Source # | |
Defined in Dojang.Types.EnvironmentPredicate Methods (==) :: EnvironmentPredicate -> EnvironmentPredicate -> Bool # (/=) :: EnvironmentPredicate -> EnvironmentPredicate -> Bool # | |
| Hashable EnvironmentPredicate Source # | |
Defined in Dojang.Types.EnvironmentPredicate | |
normalizePredicate :: EnvironmentPredicate -> EnvironmentPredicate Source #
Normalize an environment predicate by removing redundant predicates.
>>>normalizePredicate $ And [Not Always, Always]Not Always>>>normalizePredicate $ Or [Not Always, Always]Always>>>import Dojang.Types.MonikerName (parseMonikerName)>>>let Right foo = parseMonikerName "foo">>>normalizePredicate $ And [Moniker foo, Not $ Moniker foo]Not Always>>>normalizePredicate $ Or [Moniker foo, Not $ Moniker foo]Always>>>let Right a = parseMonikerName "a">>>let Right b = parseMonikerName "b">>>let Right c = parseMonikerName "c">>>normalizePredicate $ And [Moniker a, And [Moniker b, Moniker c]]And (Moniker (MonikerName "a") :| [Moniker (MonikerName "b"),Moniker (MonikerName "c")])