summaryrefslogtreecommitdiff
path: root/src/Propellor/Types.hs
diff options
context:
space:
mode:
authorJoey Hess2014-12-08 01:06:19 -0400
committerJoey Hess2014-12-08 01:07:25 -0400
commit4e9b01a8a7005905ecec37d1cd6a11d3b27676b7 (patch)
tree13afcfd63dd6522990ac19a63cb51e1a689391ac /src/Propellor/Types.hs
parent42a0c832483296fb111279fc3512a3dfd44f2089 (diff)
propellor spin
(cherry picked from commit 1d02d589c79781cc4b0bd82467edbdf64c40f34d)
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)