summaryrefslogtreecommitdiff
path: root/Types
diff options
context:
space:
mode:
Diffstat (limited to 'Types')
-rw-r--r--Types/Crypto.hs8
-rw-r--r--Types/TrustLevel.hs10
-rw-r--r--Types/UUID.hs15
3 files changed, 7 insertions, 26 deletions
diff --git a/Types/Crypto.hs b/Types/Crypto.hs
index a39a016b8..a9d3dddc5 100644
--- a/Types/Crypto.hs
+++ b/Types/Crypto.hs
@@ -7,17 +7,9 @@
module Types.Crypto where
-import Data.String.Utils
-
-- XXX ideally, this would be a locked memory region
newtype Cipher = Cipher String
data EncryptedCipher = EncryptedCipher String KeyIds
newtype KeyIds = KeyIds [String]
-
-instance Show KeyIds where
- show (KeyIds ks) = join "," ks
-
-instance Read KeyIds where
- readsPrec _ s = [(KeyIds (split "," s), "")]
diff --git a/Types/TrustLevel.hs b/Types/TrustLevel.hs
index 058ce4595..ddb8e45e4 100644
--- a/Types/TrustLevel.hs
+++ b/Types/TrustLevel.hs
@@ -17,14 +17,4 @@ import Types.UUID
data TrustLevel = SemiTrusted | UnTrusted | Trusted
deriving Eq
-instance Show TrustLevel where
- show SemiTrusted = "?"
- show UnTrusted = "0"
- show Trusted = "1"
-
-instance Read TrustLevel where
- readsPrec _ "1" = [(Trusted, "")]
- readsPrec _ "0" = [(UnTrusted, "")]
- readsPrec _ _ = [(SemiTrusted, "")]
-
type TrustMap = M.Map UUID TrustLevel
diff --git a/Types/UUID.hs b/Types/UUID.hs
index f7232d0b9..767cd0dfe 100644
--- a/Types/UUID.hs
+++ b/Types/UUID.hs
@@ -9,13 +9,12 @@ 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)
+ deriving (Eq, Ord, Show)
-instance Show UUID where
- show (UUID u) = u
- show NoUUID = ""
+fromUUID :: UUID -> String
+fromUUID (UUID u) = u
+fromUUID NoUUID = ""
-instance Read UUID where
- readsPrec _ s
- | null s = [(NoUUID, "")]
- | otherwise = [(UUID s, "")]
+toUUID :: String -> UUID
+toUUID [] = NoUUID
+toUUID s = UUID s