2011-06-01 23:10:38 +00:00
|
|
|
{- git-annex UUID type
|
|
|
|
-
|
|
|
|
- Copyright 2011 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2011-06-02 01:56:04 +00:00
|
|
|
module Types.UUID where
|
2011-06-01 23:10:38 +00:00
|
|
|
|
2011-11-07 18:46:01 +00:00
|
|
|
-- A UUID is either an arbitrary opaque string, or UUID info may be missing.
|
|
|
|
data UUID = NoUUID | UUID String
|
2011-11-08 03:21:22 +00:00
|
|
|
deriving (Eq, Ord, Show)
|
2011-11-07 18:46:01 +00:00
|
|
|
|
2011-11-08 03:21:22 +00:00
|
|
|
fromUUID :: UUID -> String
|
|
|
|
fromUUID (UUID u) = u
|
|
|
|
fromUUID NoUUID = ""
|
2011-11-07 18:46:01 +00:00
|
|
|
|
2011-11-08 03:21:22 +00:00
|
|
|
toUUID :: String -> UUID
|
|
|
|
toUUID [] = NoUUID
|
|
|
|
toUUID s = UUID s
|