Skip to content

Commit

Permalink
Aesthetic changes only.
Browse files Browse the repository at this point in the history
Signed-off-by: Magnus Therning <magnus@therning.org>
  • Loading branch information
magthe committed May 9, 2015
1 parent f542b6d commit 79179b4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/Codec/Binary/Base32.hs
Expand Up @@ -162,10 +162,10 @@ b32_decode_final bs = U.unsafePerformIO $ unsafeUseAsCStringLen bs $ \ (inBuf, i
-- >>> encode $ Data.ByteString.Char8.pack "foobar"
-- "MZXW6YTBOI======"
encode :: BS.ByteString -> BS.ByteString
encode bs = let
encode bs = first `BS.append` final
where
(first, rest) = b32_encode_part bs
Just final = b32_encode_final rest
in first `BS.append` final

-- | Convenience function that combines 'b32_decode_part' and
-- 'b32_decode_final' to decode a complete string.
Expand Down
4 changes: 2 additions & 2 deletions src/Codec/Binary/Base32Hex.hs
Expand Up @@ -146,10 +146,10 @@ b32h_decode_final bs = U.unsafePerformIO $ unsafeUseAsCStringLen bs $ \ (inBuf,
-- >>> encode $ Data.ByteString.Char8.pack "foobar"
-- "CPNMUOJ1E8======"
encode :: BS.ByteString -> BS.ByteString
encode bs = let
encode bs = first `BS.append` final
where
(first, rest) = b32h_encode_part bs
Just final = b32h_encode_final rest
in first `BS.append` final

-- | Convenience function that combines 'b32h_decode_part' and
-- 'b32h_decode_final' to decode a complete string.
Expand Down
4 changes: 2 additions & 2 deletions src/Codec/Binary/Base64.hs
Expand Up @@ -162,10 +162,10 @@ b64_decode_final bs = U.unsafePerformIO $ unsafeUseAsCStringLen bs $ \ (inBuf, i
-- >>> encode $ Data.ByteString.Char8.pack "foobar"
-- "Zm9vYmFy"
encode :: BS.ByteString -> BS.ByteString
encode bs = let
encode bs = first `BS.append` final
where
(first, rest) = b64_encode_part bs
Just final = b64_encode_final rest
in first `BS.append` final

-- | Convenience function that combines 'b64_decode_part' and
-- 'b64_decode_final' to decode a complete string.
Expand Down
4 changes: 2 additions & 2 deletions src/Codec/Binary/Base64Url.hs
Expand Up @@ -105,10 +105,10 @@ b64u_decode_final bs = U.unsafePerformIO $ unsafeUseAsCStringLen bs $ \ (inBuf,
else free outBuf >> return Nothing

encode :: BS.ByteString -> BS.ByteString
encode bs = let
encode bs = first `BS.append` final
where
(first, rest) = b64u_encode_part bs
Just final = b64u_encode_final rest
in first `BS.append` final

decode :: BS.ByteString -> Either (BS.ByteString, BS.ByteString) BS.ByteString
decode bs = either
Expand Down
11 changes: 4 additions & 7 deletions src/Codec/Binary/Base85.hs
Expand Up @@ -150,10 +150,10 @@ b85_decode_final bs = U.unsafePerformIO $ unsafeUseAsCStringLen bs $ \ (inBuf, i
-- >>> encode $ Data.ByteString.Char8.pack "foobar"
-- "AoDTs@<)"
encode :: BS.ByteString -> BS.ByteString
encode bs = let
encode bs = first `BS.append` final
where
(first, rest) = b85_encode_part bs
Just final = b85_encode_final rest
in first `BS.append` final

-- | Convenience function that combines 'b85_decode_part' and
-- 'b85_decode_final' to decode a complete string.
Expand All @@ -163,7 +163,8 @@ encode bs = let
-- >>> encode $ Data.ByteString.Char8.pack "AoDTs@<)"
-- "foobar"
decode :: BS.ByteString -> Either (BS.ByteString, BS.ByteString) BS.ByteString
decode bs = let
decode bs = either Left handleFinal (iterateDecode [] bs)
where
iterateDecode bss re = case b85_decode_part re of
Right (d, r) ->
if BS.null d
Expand All @@ -176,7 +177,3 @@ decode bs = let
(\ final -> Right (first `BS.append` final))
(b85_decode_final rest)

in either
Left
handleFinal
(iterateDecode [] bs)
4 changes: 2 additions & 2 deletions src/Codec/Binary/Uu.hs
Expand Up @@ -168,10 +168,10 @@ uu_decode_final bs = U.unsafePerformIO $ unsafeUseAsCStringLen bs $ \ (inBuf, in
-- >>> encode $ Data.ByteString.Char8.pack "foobar"
-- "9F]O8F%R"
encode :: BS.ByteString -> BS.ByteString
encode bs = let
encode bs = first `BS.append` final
where
(first, rest) = uu_encode_part bs
Just final = uu_encode_final rest
in first `BS.append` final

-- | Convenience function that combines 'uu_decode_part' and
-- 'uu_decode_final' to decode a complete string.
Expand Down
4 changes: 2 additions & 2 deletions src/Codec/Binary/Xx.hs
Expand Up @@ -137,10 +137,10 @@ xx_decode_final bs = U.unsafePerformIO $ unsafeUseAsCStringLen bs $ \ (inBuf, in
else free outBuf >> return Nothing

encode :: BS.ByteString -> BS.ByteString
encode bs = let
encode bs = first `BS.append` final
where
(first, rest) = xx_encode_part bs
Just final = xx_encode_final rest
in first `BS.append` final

decode :: BS.ByteString -> Either (BS.ByteString, BS.ByteString) BS.ByteString
decode bs = either
Expand Down

0 comments on commit 79179b4

Please sign in to comment.