summaryrefslogtreecommitdiff
path: root/src/Propellor/Property.hs
diff options
context:
space:
mode:
authorJoey Hess2014-11-19 23:11:34 -0400
committerJoey Hess2014-11-19 23:11:34 -0400
commitd49d2518979c7b985af8f00741f2a91bcd511024 (patch)
tree9adefd40c6fa82e6f27e57c84817abd0c56b1577 /src/Propellor/Property.hs
parentb7d78e679ab94a93732f48f4446c1b55bf3dae32 (diff)
separate docker container type
Docker containers are now a separate data type, cannot be included in the main host list, and are instead passed to Docker.docked. (API change)
Diffstat (limited to 'src/Propellor/Property.hs')
-rw-r--r--src/Propellor/Property.hs33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs
index 7000b2a3..bf69ff60 100644
--- a/src/Propellor/Property.hs
+++ b/src/Propellor/Property.hs
@@ -144,27 +144,28 @@ unrevertable (RevertableProperty p1 _p2) = p1
host :: HostName -> Host
host hn = Host hn [] mempty
--- | Adds a property to a Host
---
--- Can add Properties and RevertableProperties
-(&) :: IsProp p => Host -> p -> Host
-(Host hn ps is) & p = Host hn (ps ++ [toProp p]) (is <> getInfo p)
-
-infixl 1 &
+class Hostlike h where
+ -- | Adds a property to a Host
+ --
+ -- Can add Properties and RevertableProperties
+ (&) :: IsProp p => h -> p -> h
+ -- | Like (&), but adds the property as the
+ -- first property of the host. Normally, property
+ -- order should not matter, but this is useful
+ -- when it does.
+ (&^) :: IsProp p => h -> p -> h
+
+instance Hostlike Host where
+ (Host hn ps is) & p = Host hn (ps ++ [toProp p]) (is <> getInfo p)
+ (Host hn ps is) &^ p = Host hn ([toProp p] ++ ps) (getInfo p <> is)
-- | Adds a property to the Host in reverted form.
-(!) :: Host -> RevertableProperty -> Host
+(!) :: Hostlike h => h -> RevertableProperty -> h
h ! p = h & revert p
-infixl 1 !
-
--- | Like (&), but adds the property as the first property of the host.
--- Normally, property order should not matter, but this is useful
--- when it does.
-(&^) :: IsProp p => Host -> p -> Host
-(Host hn ps is) &^ p = Host hn ([toProp p] ++ ps) (getInfo p <> is)
-
infixl 1 &^
+infixl 1 &
+infixl 1 !
-- Changes the action that is performed to satisfy a property.
adjustProperty :: Property -> (Propellor Result -> Propellor Result) -> Property