summaryrefslogtreecommitdiff
path: root/Remote/Helper
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-30 00:55:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-30 00:55:59 -0400
commit3026baf7ba4941029f3fb50888b3fd3290f720d1 (patch)
treedf34479c82189dde4d65453ee08a8195fb1bca59 /Remote/Helper
parentdf31307f2ce1b037b68f16f9cb0187cf1e3a7b6d (diff)
avoid unnecessary Maybe
Diffstat (limited to 'Remote/Helper')
-rw-r--r--Remote/Helper/Chunked.hs5
-rw-r--r--Remote/Helper/Encryptable.hs7
2 files changed, 5 insertions, 7 deletions
diff --git a/Remote/Helper/Chunked.hs b/Remote/Helper/Chunked.hs
index 4f04a1c38..04bde4c29 100644
--- a/Remote/Helper/Chunked.hs
+++ b/Remote/Helper/Chunked.hs
@@ -20,9 +20,8 @@ import qualified Control.Exception as E
type ChunkSize = Maybe Int64
{- Gets a remote's configured chunk size. -}
-chunkSize :: Maybe RemoteConfig -> ChunkSize
-chunkSize Nothing = Nothing
-chunkSize (Just m) =
+chunkSize :: RemoteConfig -> ChunkSize
+chunkSize m =
case M.lookup "chunksize" m of
Nothing -> Nothing
Just v -> case readSize dataUnits v of
diff --git a/Remote/Helper/Encryptable.hs b/Remote/Helper/Encryptable.hs
index 05aca9a41..d322a5cf8 100644
--- a/Remote/Helper/Encryptable.hs
+++ b/Remote/Helper/Encryptable.hs
@@ -44,7 +44,7 @@ encryptionSetup c = case (M.lookup "encryption" c, extractCipher c) of
- Two additional functions must be provided by the remote,
- to support storing and retrieving encrypted content. -}
encryptableRemote
- :: Maybe RemoteConfig
+ :: RemoteConfig
-> ((Cipher, Key) -> Key -> MeterUpdate -> Annex Bool)
-> ((Cipher, Key) -> Key -> FilePath -> Annex Bool)
-> Remote
@@ -103,9 +103,8 @@ embedCreds c
| otherwise = False
{- Gets encryption Cipher, and encrypted version of Key. -}
-cipherKey :: Maybe RemoteConfig -> Key -> Annex (Maybe (Cipher, Key))
-cipherKey Nothing _ = return Nothing
-cipherKey (Just c) k = maybe Nothing make <$> remoteCipher c
+cipherKey :: RemoteConfig -> Key -> Annex (Maybe (Cipher, Key))
+cipherKey c k = maybe Nothing make <$> remoteCipher c
where
make ciphertext = Just (ciphertext, encryptKey ciphertext k)