summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/OS.hs
diff options
context:
space:
mode:
authorJoey Hess2015-04-22 13:04:39 -0400
committerJoey Hess2015-04-22 13:04:39 -0400
commitf35ef9d6975710f2d77c2ea708c66500861d92d1 (patch)
treece00d88d1f67109b62dcdec56262e63471fba412 /src/Propellor/Types/OS.hs
parentd3dbdb1f4d47142c20a498dc9279e480900b86c5 (diff)
API change: Added User and Group newtypes, and Properties that used to use the type UserName = String were changed to use them.
Note that UserName is kept and PrivData still uses it in its sum type. This is to avoid breaking PrivData serialization.
Diffstat (limited to 'src/Propellor/Types/OS.hs')
-rw-r--r--src/Propellor/Types/OS.hs19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/Propellor/Types/OS.hs b/src/Propellor/Types/OS.hs
index 2bb41446..58bd809a 100644
--- a/src/Propellor/Types/OS.hs
+++ b/src/Propellor/Types/OS.hs
@@ -1,20 +1,19 @@
module Propellor.Types.OS (
- HostName,
- UserName,
- GroupName,
System(..),
Distribution(..),
DebianSuite(..),
isStable,
Release,
Architecture,
+ HostName,
+ UserName,
+ User(..),
+ Group(..),
+ userGroup,
) where
import Network.BSD (HostName)
-type UserName = String
-type GroupName = String
-
-- | High level description of a operating system.
data System = System Distribution Architecture
deriving (Show, Eq)
@@ -35,3 +34,11 @@ isStable _ = False
type Release = String
type Architecture = String
+
+type UserName = String
+newtype User = User UserName
+newtype Group = Group String
+
+-- | Makes a Group with the same name as the User.
+userGroup :: User -> Group
+userGroup (User u) = Group u