From f35ef9d6975710f2d77c2ea708c66500861d92d1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 22 Apr 2015 13:04:39 -0400 Subject: 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. --- src/Propellor/Types/OS.hs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Types/OS.hs') 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 -- cgit v1.2.3