diff --git a/Main.hs b/Main.hs index c0e9e6f..57d8848 100644 --- a/Main.hs +++ b/Main.hs @@ -115,24 +115,18 @@ octToInt (x : xs) = x + 8 * octToInt xs dec91 :: String -> String dec91 = C.unpack . B91.decode --- dec91 :: String -> String --- dec91 input = --- case B91.decode (C.pack input) of --- Right decoded -> C.unpack decoded --- Left errMsg -> "Error: " ++ errMsg - -- decoded | C.null decoded -> Left "Failed to decode from Base91" - -- | otherwise -> Right (C.unpack decoded) - enc91 :: String -> String enc91 = B91.encode . BSU.fromString --- enc91 :: String -> Either String String --- enc91 input = --- case B91.encode (BSU.fromString input) of --- encoded | C.null encoded -> Left "Failed to encode to Base91" --- | otherwise -> Right (C.unpack encoded) +-- dec85 = C.unpack . U.fromRight . B85.decode . BSU.fromString +dec85 :: String -> String +dec85 input = + let decoded = B85.decode (BSU.fromString input) + in case decoded of + Right decodedStr -> C.unpack decodedStr + Left (decodedStr, _) -> C.unpack decodedStr -dec85 = C.unpack . U.fromRight . B85.decode . BSU.fromString +enc85 :: String -> String enc85 = C.unpack . B85.encode . BSU.fromString -- dec64 = C.unpack . B64L.decodeLenient . BSU.fromString