diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-16 14:12:41 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-16 14:12:41 -0400 |
| commit | 199d10fe18d69f7eac1b2acbc0133d35c42ff2b8 (patch) | |
| tree | 4ce83ebda5b26e6d965f0def31b478000926386c /src/Propellor | |
| parent | 83359452a84ffcc71cf755168c064f6c5a5c6dd8 (diff) | |
wip
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/Types/Target.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Propellor/Types/Target.hs b/src/Propellor/Types/Target.hs index 9e78a03a..228aae70 100644 --- a/src/Propellor/Types/Target.hs +++ b/src/Propellor/Types/Target.hs @@ -33,6 +33,22 @@ target => Targeting newtarget -> Property (Targeting oldtarget) -> Property (Targeting newtarget') target newtarget (Property oldtarget a) = Property (intersectTarget oldtarget newtarget) a +-- | Makes a property that uses either of the two input properties, +-- depending on the targeted OS. +-- +-- If both input properties support the targeted OS, then the first will be +-- used. +orProperty + :: Property (Targeting a) + -> Property (Targeting b) + -> Property (Targeting (UnionTarget a b)) +orProperty a@(Property ta ioa) b@(Property tb iob) = + Property (unionTarget ta tb) io + where + -- TODO pick with of ioa or iob to use based on final OS of + -- system being run on. + io = undefined + ----- DEMO ---------- -- Intentionally a type error! :) --foo :: Property (Targeting '[OSDebian, OSFreeBSD]) @@ -40,6 +56,13 @@ target newtarget (Property oldtarget a) = Property (intersectTarget oldtarget ne -- ensureProperty supportedos jail -- where supportedos = includeTarget debian freeBSD +--bar :: Property (Targeting '[OSDebian, OSFreeBSD]) +bar = aptinstall `orProperty` jail + +aptinstall :: Property DebianOnly +aptinstall = target debian $ mkProperty $ do + return () + jail :: Property FreeBSDOnly jail = target freeBSD $ mkProperty $ do return () |
