propellor-5.13: property-based host configuration management in haskell

Safe Haskell | None
Language | Haskell2010

Propellor.Types.ResultCheck

Synopsis

- data UncheckedProperty i
- unchecked :: Property i -> UncheckedProperty i
- checkResult :: (Checkable p i, LiftPropellor m) => m a -> (a -> m Result) -> p i -> Property i
- check :: (Checkable p i, LiftPropellor m) => m Bool -> p i -> Property i
- class Checkable p i
- assume :: Checkable p i => p i -> Result -> Property i

# Documentation

data UncheckedProperty i Source #

This is a `Property` but its `Result` is not accurate; in particular it may return `NoChange` despite having made a change.

However, when it returns `MadeChange`, it really did make a change, and `FailedChange` is still an error.

#### Instances

Instances details

TightenTargets UncheckedProperty Source # |
Instance details Defined in Propellor.Types.ResultCheck Methods tightenTargets :: forall (untightened :: [MetaType]) (tightened :: [MetaType]). (TightenTargetsAllowed untightened tightened, SingI tightened) => UncheckedProperty (MetaTypes untightened) -> UncheckedProperty (MetaTypes tightened) Source #
Checkable UncheckedProperty i Source # |
Instance details Defined in Propellor.Types.ResultCheck Methods checkedProp :: UncheckedProperty i -> Property i preCheckedProp :: UncheckedProperty i -> Property i

unchecked :: Property i -> UncheckedProperty i Source #

Use to indicate that a Property is unchecked.

checkResult Source #

Arguments

:: (Checkable p i, LiftPropellor m) |
=> m a | Run before ensuring the property.
-> (a -> m Result) | Run after ensuring the property. Return `MadeChange` if a change was detected, or `NoChange` if no change was detected.
-> p i |
-> Property i |

Checks the result of a property. Mostly used to convert a `UncheckedProperty` to a `Property`, but can also be used to further check a `Property`.

check :: (Checkable p i, LiftPropellor m) => m Bool -> p i -> Property i Source #

Makes a `Property` or an `UncheckedProperty` only run when a test succeeds.

class Checkable p i Source #

Minimal complete definition

checkedProp, preCheckedProp

#### Instances

Instances details

Checkable Property i Source # |
Instance details Defined in Propellor.Types.ResultCheck Methods checkedProp :: Property i -> Property i preCheckedProp :: Property i -> Property i
Checkable UncheckedProperty i Source # |
Instance details Defined in Propellor.Types.ResultCheck Methods checkedProp :: UncheckedProperty i -> Property i preCheckedProp :: UncheckedProperty i -> Property i

assume :: Checkable p i => p i -> Result -> Property i Source #

Sometimes it's not practical to test if a property made a change. In such a case, it's often fine to say:

    someprop `assume` MadeChange

However, beware assuming `NoChange`, as that will make combinators like `onChange` not work.