summaryrefslogtreecommitdiff
path: root/src/Propellor/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Types.hs')
-rw-r--r--src/Propellor/Types.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs
index 72e0e7ad..63abd226 100644
--- a/src/Propellor/Types.hs
+++ b/src/Propellor/Types.hs
@@ -14,6 +14,7 @@ module Propellor.Types
, requires
, Desc
, Result(..)
+ , ToResult(..)
, ActionResult(..)
, CmdLine(..)
, PrivDataField(..)
@@ -131,6 +132,13 @@ instance Monoid Result where
mappend _ MadeChange = MadeChange
mappend NoChange NoChange = NoChange
+class ToResult t where
+ toResult :: t -> Result
+
+instance ToResult Bool where
+ toResult False = FailedChange
+ toResult True = MadeChange
+
-- | Results of actions, with color.
class ActionResult a where
getActionResult :: a -> (String, ColorIntensity, Color)