summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/OS.hs
diff options
context:
space:
mode:
authorJoey Hess2017-02-26 16:11:38 -0400
committerJoey Hess2017-02-26 16:17:19 -0400
commit55ed8e8743e861e2230e40670a56034353cf4e32 (patch)
tree3e5f8a965569f1dcf8a7c3cabd10e663924208dd /src/Propellor/Types/OS.hs
parent2ba4b6fb3d29b2b65aa60f4bd591ed8cf6a63e27 (diff)
use ConfigurableValue where applicable
* Removed fromPort (use val instead). (API change) * Removed several Show instances that were only used for generating configuration, replacing with ConfigurableValue instances. (API change) It's somewhat annoying that IsInfo requires a Show instance. That's needed to be able to display Info in ghci, but some non-derived Show instances had to be kept to support that.
Diffstat (limited to 'src/Propellor/Types/OS.hs')
-rw-r--r--src/Propellor/Types/OS.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Propellor/Types/OS.hs b/src/Propellor/Types/OS.hs
index 696c36b0..8d7f1ba3 100644
--- a/src/Propellor/Types/OS.hs
+++ b/src/Propellor/Types/OS.hs
@@ -18,10 +18,11 @@ module Propellor.Types.OS (
Group(..),
userGroup,
Port(..),
- fromPort,
systemToTargetOS,
) where
+import Propellor.Types.ConfigurableValue
+
import Network.BSD (HostName)
import Data.Typeable
import Data.String
@@ -75,10 +76,13 @@ instance IsString FBSDVersion where
fromString "9.3-RELEASE" = FBSD093
fromString _ = error "Invalid FreeBSD release"
+instance ConfigurableValue FBSDVersion where
+ val FBSD101 = "10.1-RELEASE"
+ val FBSD102 = "10.2-RELEASE"
+ val FBSD093 = "9.3-RELEASE"
+
instance Show FBSDVersion where
- show FBSD101 = "10.1-RELEASE"
- show FBSD102 = "10.2-RELEASE"
- show FBSD093 = "9.3-RELEASE"
+ show = val
isStable :: DebianSuite -> Bool
isStable (Stable _) = True
@@ -148,5 +152,5 @@ userGroup (User u) = Group u
newtype Port = Port Int
deriving (Eq, Ord, Show)
-fromPort :: Port -> String
-fromPort (Port p) = show p
+instance ConfigurableValue Port where
+ val (Port p) = show p