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:06:19 -0400
commit1d02d589c79781cc4b0bd82467edbdf64c40f34d (patch)
treedaa3e9b20efa1e9ba013bfac8be1c2ed94df8edc /src/Propellor/Types.hs
parent27d00296ec549e17ec94125dc82fb9f2fb0fb34f (diff)
propellor spin
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)