summaryrefslogtreecommitdiff
path: root/Command/TransferKeys.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-21 16:08:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-21 16:08:59 -0400
commitd5f7fb27aad3e2e9c4bebb9ccd5577af8deb25c7 (patch)
tree838837e3112942fcf0f82cfc7f68e62a6f4e7a6e /Command/TransferKeys.hs
parent9a8709f064c7608859b3155a752093b29cd8ab98 (diff)
reorganize numcopies code (no behavior changes)
Move stuff into Logs.NumCopies. Add a NumCopies newtype. Better names for various serialization classes that are specific to one thing or another.
Diffstat (limited to 'Command/TransferKeys.hs')
-rw-r--r--Command/TransferKeys.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/Command/TransferKeys.hs b/Command/TransferKeys.hs
index 9c05702be..b42628609 100644
--- a/Command/TransferKeys.hs
+++ b/Command/TransferKeys.hs
@@ -106,34 +106,34 @@ readResponse h = fromMaybe False . deserialize <$> hGetLine h
fieldSep :: String
fieldSep = "\0"
-class Serialized a where
+class TCSerialized a where
serialize :: a -> String
deserialize :: String -> Maybe a
-instance Serialized Bool where
+instance TCSerialized Bool where
serialize True = "1"
serialize False = "0"
deserialize "1" = Just True
deserialize "0" = Just False
deserialize _ = Nothing
-instance Serialized Direction where
+instance TCSerialized Direction where
serialize Upload = "u"
serialize Download = "d"
deserialize "u" = Just Upload
deserialize "d" = Just Download
deserialize _ = Nothing
-instance Serialized AssociatedFile where
+instance TCSerialized AssociatedFile where
serialize (Just f) = f
serialize Nothing = ""
deserialize "" = Just Nothing
deserialize f = Just $ Just f
-instance Serialized UUID where
+instance TCSerialized UUID where
serialize = fromUUID
deserialize = Just . toUUID
-instance Serialized Key where
+instance TCSerialized Key where
serialize = key2file
deserialize = file2key