|
@@ -28,7 +28,6 @@ import qualified Data.ByteString.Base64 as B64
|
|
import qualified Codec.Binary.UTF8.String as UTF8
|
|
import qualified Codec.Binary.UTF8.String as UTF8
|
|
import qualified Data.ByteString as BS
|
|
import qualified Data.ByteString as BS
|
|
|
|
|
|
-
|
|
|
|
utf8bs :: String -> ByteString
|
|
utf8bs :: String -> ByteString
|
|
utf8bs = BS.pack . UTF8.encode
|
|
utf8bs = BS.pack . UTF8.encode
|
|
|
|
|
|
@@ -97,7 +96,7 @@ parseShow (s:ss) = ((string . utf8bs . show $ s) *> return s) <|> parseShow ss
|
|
-- | Like parseShow, but case insensitive.
|
|
-- | Like parseShow, but case insensitive.
|
|
parseShowCI :: Show a => [a] -> Parser a
|
|
parseShowCI :: Show a => [a] -> Parser a
|
|
parseShowCI [] = failParser
|
|
parseShowCI [] = failParser
|
|
-parseShowCI (s:ss) = ((stringCI . utf8bs . show $ s) *> return s) <|> parseShow ss
|
|
|
|
|
|
+parseShowCI (s:ss) = ((A.stringCI . utf8bs . show $ s) *> return s) <|> parseShowCI ss
|
|
|
|
|
|
{- |
|
|
{- |
|
|
Given a list of options and a printing function, returns the first option that is
|
|
Given a list of options and a printing function, returns the first option that is
|
|
@@ -105,12 +104,12 @@ printed like the input.
|
|
-}
|
|
-}
|
|
parsePrintable :: (a -> String) -> [a] -> Parser a
|
|
parsePrintable :: (a -> String) -> [a] -> Parser a
|
|
parsePrintable _ [] = failParser
|
|
parsePrintable _ [] = failParser
|
|
-parsePrintable f (s:ss) = ((stringCI . utf8bs . f $ s) *> return s) <|> parsePrintable f ss
|
|
|
|
|
|
+parsePrintable f (s:ss) = ((string . utf8bs . f $ s) *> return s) <|> parsePrintable f ss
|
|
|
|
|
|
-- | Like parsePrintable, but case insensitive
|
|
-- | Like parsePrintable, but case insensitive
|
|
parsePrintableCI :: (a -> String) -> [a] -> Parser a
|
|
parsePrintableCI :: (a -> String) -> [a] -> Parser a
|
|
parsePrintableCI _ [] = failParser
|
|
parsePrintableCI _ [] = failParser
|
|
-parsePrintableCI f (s:ss) = ((stringCI . utf8bs . f $ s) *> return s) <|> parsePrintable f ss
|
|
|
|
|
|
+parsePrintableCI f (s:ss) = ((A.stringCI . utf8bs . f $ s) *> return s) <|> parsePrintableCI f ss
|
|
|
|
|
|
-- | Acts like parseShow, trying every possible value
|
|
-- | Acts like parseShow, trying every possible value
|
|
parseEnum :: (Enum a, Bounded a, Show a) => Parser a
|
|
parseEnum :: (Enum a, Bounded a, Show a) => Parser a
|
|
@@ -122,7 +121,7 @@ parseEnum = let
|
|
parseEnumCI :: (Enum a, Bounded a, Show a) => Parser a
|
|
parseEnumCI :: (Enum a, Bounded a, Show a) => Parser a
|
|
parseEnumCI = let
|
|
parseEnumCI = let
|
|
l = [minBound .. maxBound]
|
|
l = [minBound .. maxBound]
|
|
- in parseShow l
|
|
|
|
|
|
+ in parseShowCI l
|
|
|
|
|
|
-- | Consumes base64 encoded text, returning its binary decoded value.
|
|
-- | Consumes base64 encoded text, returning its binary decoded value.
|
|
decodeBase64 :: Parser ByteString
|
|
decodeBase64 :: Parser ByteString
|