summaryrefslogtreecommitdiff
path: root/Types/UUID.hs
blob: 767cd0dfe8610c6da205e5ec1ed04463a4dbe9ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{- git-annex UUID type
 -
 - Copyright 2011 Joey Hess <joey@kitenet.net>
 -
 - Licensed under the GNU GPL version 3 or higher.
 -}

module Types.UUID where

-- A UUID is either an arbitrary opaque string, or UUID info may be missing.
data UUID = NoUUID | UUID String
	deriving (Eq, Ord, Show)

fromUUID :: UUID -> String
fromUUID (UUID u) = u
fromUUID NoUUID = ""

toUUID :: String -> UUID
toUUID [] = NoUUID
toUUID s = UUID s