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

Safe Haskell | None
Language | Haskell98

Propellor.EnsureProperty

Synopsis

- ensureProperty :: (Cannot_ensureProperty_WithInfo inner ~ True, (Targets inner `NotSuperset` Targets outer) ~ CanCombine) => OuterMetaTypesWitness outer -> Property (MetaTypes inner) -> Propellor Result
- property' :: SingI metatypes => Desc -> (OuterMetaTypesWitness metatypes -> Propellor Result) -> Property (MetaTypes metatypes)
- newtype OuterMetaTypesWitness metatypes = OuterMetaTypesWitness (MetaTypes metatypes)
- type family Cannot_ensureProperty_WithInfo (l :: [a]) :: Bool

# Documentation

ensureProperty :: (Cannot_ensureProperty_WithInfo inner ~ True, (Targets inner `NotSuperset` Targets outer) ~ CanCombine) => OuterMetaTypesWitness outer -> Property (MetaTypes inner) -> Propellor Result Source #

For when code running in the Propellor monad needs to ensure a Property.

Use `property'` to get the `OuterMetaTypesWithness`. For example:

    foo = Property Debian
    foo = property' "my property" $ \w -> do
    	ensureProperty w (aptInstall "foo")

The type checker will prevent using ensureProperty with a property that does not support the target OSes needed by the OuterMetaTypesWitness. In the example above, aptInstall must support Debian, since foo is supposed to support Debian.

The type checker will also prevent using ensureProperty with a property with HasInfo in its MetaTypes. Doing so would cause the `Info` associated with the property to be lost.

property' :: SingI metatypes => Desc -> (OuterMetaTypesWitness metatypes -> Propellor Result) -> Property (MetaTypes metatypes) Source #

Constructs a property, like `property`, but provides its `OuterMetaTypesWitness`.

newtype OuterMetaTypesWitness metatypes Source #

Used to provide the metatypes of a Property to calls to `ensureProperty` within it.

Constructors

OuterMetaTypesWitness (MetaTypes metatypes) |

type family Cannot_ensureProperty_WithInfo (l :: [a]) :: Bool Source #

Instances

type Cannot_ensureProperty_WithInfo a ([] a) Source # |
type Cannot_ensureProperty_WithInfo a ([] a) = True
type Cannot_ensureProperty_WithInfo MetaType ((:) MetaType t ts) Source # |
type Cannot_ensureProperty_WithInfo MetaType ((:) MetaType t ts) = (&&) (Not (EqT MetaType t WithInfo)) (Cannot_ensureProperty_WithInfo MetaType ts)