summaryrefslogtreecommitdiff
path: root/src/Propellor/Types
diff options
context:
space:
mode:
authorJoey Hess2016-03-24 11:43:19 -0400
committerJoey Hess2016-03-24 11:43:19 -0400
commitfa2a2324f8223a0f628472e2ee5fdb69495cd17f (patch)
treef18fb689418472aa33ff5db733e907fd5bcb1050 /src/Propellor/Types
parent7b7ad7e685cccb7ff2c609d92192bf7d983fc400 (diff)
temporarily remove UsedPort
This can come back later as a full Resource data type. For now, I want to focus on merging what I have working.
Diffstat (limited to 'src/Propellor/Types')
-rw-r--r--src/Propellor/Types/PropTypes.hs31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/Propellor/Types/PropTypes.hs b/src/Propellor/Types/PropTypes.hs
index d20a4345..4ea4746a 100644
--- a/src/Propellor/Types/PropTypes.hs
+++ b/src/Propellor/Types/PropTypes.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, TypeOperators, PolyKinds, DataKinds, TypeFamilies, UndecidableInstances, FlexibleInstances, GADTs #-}
+{-# LANGUAGE TypeOperators, PolyKinds, DataKinds, TypeFamilies, UndecidableInstances, FlexibleInstances, GADTs #-}
module Propellor.Types.PropTypes (
Property(..),
@@ -21,13 +21,6 @@ module Propellor.Types.PropTypes (
SingI,
) where
-import GHC.TypeLits (Nat)
-
--- Older versions of ghc lack this module.
--- #if MIN_VERSION_base(4,8,0)
-import Data.Type.Equality
--- #endif
-
----- DEMO ----------
foo :: Property (HasInfo + FreeBSD)
@@ -37,7 +30,7 @@ foo = mkProperty' $ \t -> do
-- bar :: Property (Debian + UsesPort 80 + FreeBSD)
-- bar = aptinstall `pickOS` jail
-aptinstall :: Property (Debian + UsesPort 80)
+aptinstall :: Property Debian
aptinstall = mkProperty $ do
return ()
@@ -60,7 +53,6 @@ mkProperty' a =
data PropType
= Targeting OS -- ^ A target OS of a Property
| WithInfo -- ^ Indicates that a Property has associated Info
- | UsedPort Nat -- ^ Indicates that a network port is used by a Property
data OS
= OSDebian
@@ -77,9 +69,6 @@ type FreeBSD = Sing '[ 'Targeting 'OSFreeBSD ]
-- | Used to indicate that a Property adds Info to the Host where it's used.
type HasInfo = Sing '[ 'WithInfo ]
--- | Used to indicate that a Property uses a network port
-type UsesPort n = Sing '[ 'UsedPort n ]
-
-- | The data family of singleton types.
data family Sing (x :: k)
@@ -94,12 +83,10 @@ data instance Sing (x :: PropType) where
OSBuntishS :: Sing ('Targeting 'OSBuntish)
OSFreeBSDS :: Sing ('Targeting 'OSFreeBSD)
WithInfoS :: Sing 'WithInfo
- WithUsedPortS :: Sing n -> Sing ('UsedPort n)
instance SingI ('Targeting 'OSDebian) where sing = OSDebianS
instance SingI ('Targeting 'OSBuntish) where sing = OSBuntishS
instance SingI ('Targeting 'OSFreeBSD) where sing = OSFreeBSDS
instance SingI 'WithInfo where sing = WithInfoS
-instance (SingI n) => SingI ('UsedPort n) where sing = WithUsedPortS sing
data instance Sing (x :: [k]) where
Nil :: Sing '[]
@@ -107,12 +94,6 @@ data instance Sing (x :: [k]) where
instance (SingI x, SingI xs) => SingI (x ': xs) where sing = Cons sing sing
instance SingI '[] where sing = Nil
--- FIXME: How to implement sing for Nat?
---
--- Since we don't actually currently use the values of singletons,
--- getting by with undefined for now.
-instance SingI (n :: Nat) where sing = undefined
-
-- | Convenience type operator to combine two `Sing` lists.
--
-- For example:
@@ -270,14 +251,6 @@ type instance EqT 'OSBuntish 'OSDebian = 'False
type instance EqT 'OSBuntish 'OSFreeBSD = 'False
type instance EqT 'OSFreeBSD 'OSDebian = 'False
type instance EqT 'OSFreeBSD 'OSBuntish = 'False
--- #if MIN_VERSION_base(4,8,0)
-type instance EqT ('UsedPort a) ('UsedPort b) = a == b
--- #else
--- On older ghc, equality testing of type Nats is not implemented.
--- Assume two Nats are equal. This means that type level port conflict
--- detection won't work when using ghc 7.6.3.
---type instance EqT ('UsedPort a) ('UsedPort b) = True
--- #endif
-- More modern version if the combinatiorial explosion gets too bad later:
--
-- type family Eq (a :: PropType) (b :: PropType) where