@@ -54,7 +54,6 @@ module Streamly.Internal.Unicode.Char.Parser
5454where
5555
5656import Control.Applicative (Alternative(..))
57−import Control.Monad.Catch (MonadCatch)
5857import Data.Bits (Bits, (.|.), shiftL)
5958import Data.Char (ord)
6059import Streamly.Internal.Data.Parser (Parser)
@@ -78,7 +77,7 @@ import qualified Streamly.Internal.Data.Parser as Parser
7877-- We can measure if there is a signficant difference and if so we can add such
7978-- predicates to Streamly.Unicode.Parser.Latin1.
8079--
81−#define CHAR_PARSER_SIG(NAME) NAME :: MonadCatch m => Parser Char m Char
80+#define CHAR_PARSER_SIG(NAME) NAME :: Monad m => Parser Char m Char
8281-- XXX Need to use the predicates from Unicode.Char module/unicode-data package
8382#define CHAR_PARSER(NAME, PREDICATE) NAME = Parser.satisfy Char.PREDICATE
8483#define CHAR_PARSER_DOC(PREDICATE) -- | Match any character that satisfies 'Char.PREDICATE'
@@ -168,13 +167,13 @@ CHAR_PARSER(asciiLower,isAsciiLower)
168167
169168-- | Match a specific character.
170169{-# INLINE char #-}
171−char :: MonadCatch m => Char -> Parser Char m Char
170+char :: Monad m => Char -> Parser Char m Char
172171char c = Parser.satisfy (== c)
173172
174173-- XXX Case conversion may lead to change in number of chars
175174-- | Match a specific character ignoring case.
176175{-# INLINE charIgnoreCase #-}
177−charIgnoreCase :: MonadCatch m => Char -> Parser Char m Char
176+charIgnoreCase :: Monad m => Char -> Parser Char m Char
178177charIgnoreCase c = Parser.lmap Char.toLower (Parser.satisfy (== Char.toLower c))
179178
180179--------------------------------------------------------------------------------
@@ -182,21 +181,21 @@ charIgnoreCase c = Parser.lmap Char.toLower (Parser.satisfy (== Char.toLower c))
182181--------------------------------------------------------------------------------
183182
184183-- | Match the input with the supplied string and return it if successful.
185−string :: MonadCatch m => String -> Parser Char m String
184+string :: Monad m => String -> Parser Char m String
186185string = Parser.listEq
187186
188187-- XXX Not accurate unicode case conversion
189188-- | Match the input with the supplied string and return it if successful.
190−stringIgnoreCase :: MonadCatch m => String -> Parser Char m String
189+stringIgnoreCase :: Monad m => String -> Parser Char m String
191190stringIgnoreCase s =
192191 Parser.lmap Char.toLower (Parser.listEq (map Char.toLower s))
193192
194193-- | Drop /zero/ or more white space characters.
195−dropSpace :: MonadCatch m => Parser Char m ()
194+dropSpace :: Monad m => Parser Char m ()
196195dropSpace = Parser.dropWhile Char.isSpace
197196
198197-- | Drop /one/ or more white space characters.
199−dropSpace1 :: MonadCatch m => Parser Char m ()
198+dropSpace1 :: Monad m => Parser Char m ()
200199dropSpace1 = Parser.takeWhile1 Char.isSpace Fold.drain
201200
202201--------------------------------------------------------------------------------
@@ -207,7 +206,7 @@ dropSpace1 = Parser.takeWhile1 Char.isSpace Fold.drain
207206--
208207-- | Parse and decode an unsigned integral decimal number.
209208{-# INLINE decimal #-}
210−decimal :: (MonadCatch m, Integral a) => Parser Char m a
209+decimal :: (Monad m, Integral a) => Parser Char m a
211210decimal = Parser.takeWhile1 Char.isDigit (Fold.foldl' step 0)
212211
213212 where
@@ -219,7 +218,7 @@ decimal = Parser.takeWhile1 Char.isDigit (Fold.foldl' step 0)
219218--
220219-- Note: This parser does not accept a leading @\"0x\"@ string.
221220{-# INLINE hexadecimal #-}
222−hexadecimal :: (MonadCatch m, Integral a, Bits a) => Parser Char m a
221+hexadecimal :: (Monad m, Integral a, Bits a) => Parser Char m a
223222hexadecimal = Parser.takeWhile1 isHexDigit (Fold.foldl' step 0)
224223
225224 where
@@ -244,7 +243,7 @@ hexadecimal = Parser.takeWhile1 isHexDigit (Fold.foldl' step 0)
244243-- | Allow an optional leading @\'+\'@ or @\'-\'@ sign character before any
245244-- parser.
246245{-# INLINE signed #-}
247−signed :: (Num a, MonadCatch m) => Parser Char m a -> Parser Char m a
246+signed :: (Num a, Monad m) => Parser Char m a -> Parser Char m a
248247signed p = (negate <$> (char '-' *> p)) <|> (char '+' *> p) <|> p
249248
250249-- | Parse a 'Double'.