summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Whitton2017-11-12 11:23:17 -0700
committerSean Whitton2017-11-12 11:23:17 -0700
commit9fe02daf0b9653f85894ceba6b01b5e555f7f1cd (patch)
tree8d598897a71b4009d9b78e2a7bf7c2f33ad04d24 /src
parent4617ec3a1d97ffbe962cea41dba220818b438421 (diff)
parent19a0a53469ad5288fa6688f5e140994a3be63f8e (diff)
Merge branch 'master' of https://git.joeyh.name/git/propellor into sbuild-overhaul
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Property.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs
index 55e688ab..884ee683 100644
--- a/src/Propellor/Property.hs
+++ b/src/Propellor/Property.hs
@@ -32,6 +32,7 @@ module Propellor.Property (
, makeChange
, noChange
, doNothing
+ , impossible
, endAction
-- * Property result checking
, UncheckedProperty
@@ -62,6 +63,7 @@ import Propellor.Types.ResultCheck
import Propellor.Types.MetaTypes
import Propellor.Types.Singletons
import Propellor.Info
+import Propellor.Message
import Propellor.EnsureProperty
import Utility.Exception
import Utility.Monad
@@ -364,6 +366,12 @@ noChange = return NoChange
doNothing :: SingI t => Property (MetaTypes t)
doNothing = mempty
+-- | In situations where it's not possible to provide a property that
+-- works, this can be used to make a property that always fails with an
+-- error message you provide.
+impossible :: SingI t => String -> Property (MetaTypes t)
+impossible msg = property "impossible" $ errorMessage msg
+
-- | Registers an action that should be run at the very end, after
-- propellor has checks all the properties of a host.
endAction :: Desc -> (Result -> Propellor Result) -> Propellor ()