add a UUID type
Should have done this a long time ago.
This commit is contained in:
parent
b08f7c428b
commit
63a292324d
18 changed files with 67 additions and 55 deletions
|
@ -7,5 +7,15 @@
|
|||
|
||||
module Types.UUID where
|
||||
|
||||
-- might be nice to have a newtype, but lots of stuff treats uuids as strings
|
||||
type UUID = String
|
||||
-- A UUID is either an arbitrary opaque string, or UUID info may be missing.
|
||||
data UUID = NoUUID | UUID String
|
||||
deriving (Eq, Ord)
|
||||
|
||||
instance Show UUID where
|
||||
show (UUID u) = u
|
||||
show NoUUID = ""
|
||||
|
||||
instance Read UUID where
|
||||
readsPrec _ s
|
||||
| null s = [(NoUUID, "")]
|
||||
| otherwise = [(UUID s, "")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue