diff options
author | Joey Hess <joeyh@joeyh.name> | 2019-01-09 15:00:43 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2019-01-09 15:05:49 -0400 |
commit | 6f66b53a30219eea05870bfa86b0c48ccb56145c (patch) | |
tree | 5a7b72d2ad076b5badcbe2ed334ab71644266037 /Types/Group.hs | |
parent | 3f7fe1d32598e9feaccbe6745c23fc5a7ce45e2b (diff) |
newtype Group to ByteString
This may speed up queries for things in groups, due to Eq and Ord being faster.
Diffstat (limited to 'Types/Group.hs')
-rw-r--r-- | Types/Group.hs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Types/Group.hs b/Types/Group.hs index 2695670ab4..57b3f66c6a 100644 --- a/Types/Group.hs +++ b/Types/Group.hs @@ -1,22 +1,33 @@ {- git-annex repo groups - - - Copyright 2012 Joey Hess <id@joeyh.name> + - Copyright 2012, 2019 Joey Hess <id@joeyh.name> - - Licensed under the GNU GPL version 3 or higher. -} module Types.Group ( - Group, + Group(..), + fromGroup, + toGroup, GroupMap(..), emptyGroupMap ) where import Types.UUID +import Utility.FileSystemEncoding import qualified Data.Map as M import qualified Data.Set as S +import qualified Data.ByteString as S -type Group = String +newtype Group = Group S.ByteString + deriving (Eq, Ord) + +fromGroup :: Group -> String +fromGroup (Group g) = decodeBS g + +toGroup :: String -> Group +toGroup = Group . encodeBS data GroupMap = GroupMap { groupsByUUID :: M.Map UUID (S.Set Group) |