on master help sign in
Remove redundant MonadCatch/Throw from Parser module
commit3ef32ce12ef61ffb7cae09b855b7de4b0584e26b authorHarendra Kumar <harendra@composewell.com> dateSat 20 Aug 2022, 18:41 (4 years ago) parentc44c370
1 file changed+73−73
core/src/Streamly/Internal/Data/Parser.hs+73−73
core/src/Streamly/Internal/Data/Parser.hs+73−73
@@ -244,7 +244,7 @@ module Streamly.Internal.Data.Parser
244244 )
245245where
246246
247−import Control.Monad.Catch (MonadCatch, MonadThrow)
247+import Control.Monad.Catch (MonadThrow)
248248import Data.Functor (($>))
249249import Prelude hiding
250250 ( any, all, dropWhile, take, takeWhile, sequence, concatMap, maybe, either
@@ -298,7 +298,7 @@ toFold p = D.toFold $ D.fromParserK p
298298-- /Pre-release/
299299--
300300{-# INLINE fromFold #-}
301−fromFold :: MonadCatch m => Fold m a b -> Parser m a b
301+fromFold :: Monad m => Fold m a b -> Parser m a b
302302fromFold = D.toParserK . D.fromFold
303303
304304-- | Convert a Maybe returning fold to an error returning parser. The first
@@ -308,7 +308,7 @@ fromFold = D.toParserK . D.fromFold
308308-- /Pre-release/
309309--
310310{-# INLINE fromFoldMaybe #-}
311−fromFoldMaybe :: MonadCatch m => String -> Fold m a (Maybe b) -> Parser m a b
311+fromFoldMaybe :: Monad m => String -> Fold m a (Maybe b) -> Parser m a b
312312fromFoldMaybe err = D.toParserK . D.fromFoldMaybe err
313313
314314-------------------------------------------------------------------------------
@@ -322,7 +322,7 @@ fromFoldMaybe err = D.toParserK . D.fromFoldMaybe err
322322-- /Pre-release/
323323--
324324{-# INLINE [3] fromPure #-}
325−fromPure :: MonadCatch m => b -> Parser m a b
325+fromPure :: Monad m => b -> Parser m a b
326326fromPure = D.toParserK . D.fromPure
327327{-# RULES "fromPure fallback to CPS" [2]
328328 forall a. D.toParserK (D.fromPure a) = K.fromPure a #-}
@@ -335,7 +335,7 @@ fromPure = D.toParserK . D.fromPure
335335-- /Pre-release/
336336--
337337{-# INLINE fromEffect #-}
338−fromEffect :: MonadCatch m => m b -> Parser m a b
338+fromEffect :: Monad m => m b -> Parser m a b
339339fromEffect = K.fromEffect -- D.toParserK . D.fromEffect
340340
341341-- This is the dual of "nil".
@@ -346,7 +346,7 @@ fromEffect = K.fromEffect -- D.toParserK . D.fromEffect
346346-- /Pre-release/
347347--
348348{-# INLINE [3] die #-}
349−die :: MonadCatch m => String -> Parser m a b
349+die :: Monad m => String -> Parser m a b
350350die = D.toParserK . D.die
351351{-# RULES "die fallback to CPS" [2]
352352 forall a. D.toParserK (D.die a) = K.die a #-}
@@ -359,7 +359,7 @@ die = D.toParserK . D.die
359359-- /Pre-release/
360360--
361361{-# INLINE dieM #-}
362−dieM :: MonadCatch m => m String -> Parser m a b
362+dieM :: Monad m => m String -> Parser m a b
363363dieM = D.toParserK . D.dieM
364364
365365-------------------------------------------------------------------------------
@@ -375,14 +375,14 @@ dieM = D.toParserK . D.dieM
375375--
376376-- /Internal/
377377{-# INLINE lmap #-}
378−lmap :: MonadCatch m => (a -> b) -> Parser m b r -> Parser m a r
378+lmap :: Monad m => (a -> b) -> Parser m b r -> Parser m a r
379379lmap f p = D.toParserK $ D.lmap f $ D.fromParserK p
380380
381381-- | @lmapM f parser@ maps the monadic function @f@ on the input of the parser.
382382--
383383-- /Internal/
384384{-# INLINE lmapM #-}
385−lmapM :: MonadCatch m => (a -> m b) -> Parser m b r -> Parser m a r
385+lmapM :: Monad m => (a -> m b) -> Parser m b r -> Parser m a r
386386lmapM f p = D.toParserK $ D.lmapM f $ D.fromParserK p
387387
388388-- | Include only those elements that pass a predicate.
@@ -392,7 +392,7 @@ lmapM f p = D.toParserK $ D.lmapM f $ D.fromParserK p
392392--
393393-- /Internal/
394394{-# INLINE filter #-}
395−filter :: MonadCatch m => (a -> Bool) -> Parser m a b -> Parser m a b
395+filter :: Monad m => (a -> Bool) -> Parser m a b -> Parser m a b
396396filter f p = D.toParserK $ D.filter f $ D.fromParserK p
397397
398398-------------------------------------------------------------------------------
@@ -412,7 +412,7 @@ filter f p = D.toParserK $ D.filter f $ D.fromParserK p
412412-- /Pre-release/
413413--
414414{-# INLINE peek #-}
415−peek :: MonadCatch m => Parser m a a
415+peek :: Monad m => Parser m a a
416416peek = D.toParserK D.peek
417417
418418-- | Succeeds if we are at the end of input, fails otherwise.
@@ -423,7 +423,7 @@ peek = D.toParserK D.peek
423423-- /Pre-release/
424424--
425425{-# INLINE eof #-}
426−eof :: MonadCatch m => Parser m a ()
426+eof :: Monad m => Parser m a ()
427427eof = D.toParserK D.eof
428428
429429-- | Returns the next element if it passes the predicate, fails otherwise.
@@ -437,7 +437,7 @@ eof = D.toParserK D.eof
437437-- /Pre-release/
438438--
439439{-# INLINE satisfy #-}
440−satisfy :: MonadCatch m => (a -> Bool) -> Parser m a a
440+satisfy :: Monad m => (a -> Bool) -> Parser m a a
441441satisfy = D.toParserK . D.satisfy
442442
443443-- | Consume one element from the head of the stream. Fails if it encounters
@@ -448,7 +448,7 @@ satisfy = D.toParserK . D.satisfy
448448-- /Pre-release/
449449--
450450{-# INLINE one #-}
451−one :: MonadCatch m => Parser m a a
451+one :: Monad m => Parser m a a
452452one = satisfy $ const True
453453
454454-- | Match a specific element.
@@ -456,7 +456,7 @@ one = satisfy $ const True
456456-- >>> element x = Parser.satisfy (== x)
457457--
458458{-# INLINE element #-}
459−element :: (MonadCatch m, Eq a) => a -> Parser m a a
459+element :: (Monad m, Eq a) => a -> Parser m a a
460460element x = satisfy (== x)
461461
462462-- | Match anything other than the supplied element.
@@ -464,7 +464,7 @@ element x = satisfy (== x)
464464-- >>> except x = Parser.satisfy (/= x)
465465--
466466{-# INLINE except #-}
467−except :: (MonadCatch m, Eq a) => a -> Parser m a a
467+except :: (Monad m, Eq a) => a -> Parser m a a
468468except x = satisfy (/= x)
469469
470470-- | Match any one of the elements in the supplied list.
@@ -488,7 +488,7 @@ except x = satisfy (/= x)
488488-- search.
489489--
490490{-# INLINE oneOf #-}
491−oneOf :: (MonadCatch m, Eq a) => [a] -> Parser m a a
491+oneOf :: (Monad m, Eq a) => [a] -> Parser m a a
492492oneOf xs = satisfy (`elem` xs)
493493
494494-- | See performance notes in 'oneOf'.
@@ -496,7 +496,7 @@ oneOf xs = satisfy (`elem` xs)
496496-- >>> noneOf xs = Parser.satisfy (`notElem` xs)
497497--
498498{-# INLINE noneOf #-}
499−noneOf :: (MonadCatch m, Eq a) => [a] -> Parser m a a
499+noneOf :: (Monad m, Eq a) => [a] -> Parser m a a
500500noneOf xs = satisfy (`notElem` xs)
501501
502502-- | Return the next element of the input. Returns 'Nothing'
@@ -506,7 +506,7 @@ noneOf xs = satisfy (`notElem` xs)
506506--
507507{-# DEPRECATED next "Please use \"fromFold Fold.one\" instead" #-}
508508{-# INLINE next #-}
509−next :: MonadCatch m => Parser m a (Maybe a)
509+next :: Monad m => Parser m a (Maybe a)
510510next = D.toParserK D.next
511511
512512-- | Map a 'Maybe' returning function on the next element in the stream. The
@@ -521,7 +521,7 @@ next = D.toParserK D.next
521521-- /Pre-release/
522522--
523523{-# INLINE maybe #-}
524−maybe :: MonadCatch m => (a -> Maybe b) -> Parser m a b
524+maybe :: Monad m => (a -> Maybe b) -> Parser m a b
525525maybe = D.toParserK . D.maybe
526526
527527-- | Map an 'Either' returning function on the next element in the stream. If
@@ -531,7 +531,7 @@ maybe = D.toParserK . D.maybe
531531-- /Pre-release/
532532--
533533{-# INLINE either #-}
534−either :: MonadCatch m => (a -> Either String b) -> Parser m a b
534+either :: Monad m => (a -> Either String b) -> Parser m a b
535535either = D.toParserK . D.either
536536
537537-------------------------------------------------------------------------------
@@ -579,7 +579,7 @@ either = D.toParserK . D.either
579579-- /Pre-release/
580580--
581581{-# INLINE takeBetween #-}
582−takeBetween :: MonadCatch m =>
582+takeBetween :: Monad m =>
583583 Int -> Int -> Fold m a b -> Parser m a b
584584takeBetween m n = D.toParserK . D.takeBetween m n
585585
@@ -595,7 +595,7 @@ takeBetween m n = D.toParserK . D.takeBetween m n
595595-- /Pre-release/
596596--
597597{-# INLINE takeEQ #-}
598−takeEQ :: MonadCatch m => Int -> Fold m a b -> Parser m a b
598+takeEQ :: Monad m => Int -> Fold m a b -> Parser m a b
599599takeEQ n = D.toParserK . D.takeEQ n
600600
601601-- | Take at least @n@ input elements, but can collect more.
@@ -613,7 +613,7 @@ takeEQ n = D.toParserK . D.takeEQ n
613613-- /Pre-release/
614614--
615615{-# INLINE takeGE #-}
616−takeGE :: MonadCatch m => Int -> Fold m a b -> Parser m a b
616+takeGE :: Monad m => Int -> Fold m a b -> Parser m a b
617617takeGE n = D.toParserK . D.takeGE n
618618
619619-------------------------------------------------------------------------------
@@ -640,7 +640,7 @@ takeGE n = D.toParserK . D.takeGE n
640640-- /Pre-release/
641641--
642642{-# INLINE takeWhileP #-}
643−takeWhileP :: MonadCatch m => (a -> Bool) -> Parser m a b -> Parser m a b
643+takeWhileP :: Monad m => (a -> Bool) -> Parser m a b -> Parser m a b
644644takeWhileP cond p = D.toParserK $ D.takeWhileP cond (D.fromParserK p)
645645
646646-- | Collect stream elements until an element fails the predicate. The element
@@ -663,7 +663,7 @@ takeWhileP cond p = D.toParserK $ D.takeWhileP cond (D.fromParserK p)
663663-- /Pre-release/
664664--
665665{-# INLINE takeWhile #-}
666−takeWhile :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
666+takeWhile :: Monad m => (a -> Bool) -> Fold m a b -> Parser m a b
667667takeWhile cond = D.toParserK . D.takeWhile cond
668668-- takeWhile cond f = takeWhileP cond (fromFold f)
669669
@@ -674,7 +674,7 @@ takeWhile cond = D.toParserK . D.takeWhile cond
674674-- /Pre-release/
675675--
676676{-# INLINE takeWhile1 #-}
677−takeWhile1 :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
677+takeWhile1 :: Monad m => (a -> Bool) -> Fold m a b -> Parser m a b
678678takeWhile1 cond = D.toParserK . D.takeWhile1 cond
679679-- takeWhile1 cond f = takeWhileP cond (takeBetween 1 maxBound f)
680680
@@ -688,7 +688,7 @@ takeWhile1 cond = D.toParserK . D.takeWhile1 cond
688688-- /Pre-release/
689689--
690690{-# INLINE dropWhile #-}
691−dropWhile :: MonadCatch m => (a -> Bool) -> Parser m a ()
691+dropWhile :: Monad m => (a -> Bool) -> Parser m a ()
692692dropWhile p = takeWhile p FL.drain
693693
694694-------------------------------------------------------------------------------
@@ -697,7 +697,7 @@ dropWhile p = takeWhile p FL.drain
697697
698698-- XXX We can remove Maybe from esc
699699{-# INLINE takeFramedByGeneric #-}
700−takeFramedByGeneric :: MonadCatch m =>
700+takeFramedByGeneric :: Monad m =>
701701 Maybe (a -> Bool)
702702 -> Maybe (a -> Bool)
703703 -> Maybe (a -> Bool)
@@ -724,7 +724,7 @@ takeFramedByGeneric esc begin end f =
724724-- /Pre-release/
725725--
726726{-# INLINE takeEndBy #-}
727−takeEndBy :: MonadCatch m => (a -> Bool) -> Parser m a b -> Parser m a b
727+takeEndBy :: Monad m => (a -> Bool) -> Parser m a b -> Parser m a b
728728takeEndBy cond = D.toParserK . D.takeEndBy cond . D.fromParserK
729729-- takeEndBy = takeEndByEsc (const False)
730730
@@ -735,7 +735,7 @@ takeEndBy cond = D.toParserK . D.takeEndBy cond . D.fromParserK
735735-- /Pre-release/
736736--
737737{-# INLINE takeEndBy_ #-}
738−takeEndBy_ :: MonadCatch m => (a -> Bool) -> Parser m a b -> Parser m a b
738+takeEndBy_ :: Monad m => (a -> Bool) -> Parser m a b -> Parser m a b
739739takeEndBy_ cond = D.toParserK . D.takeEndBy_ cond . D.fromParserK
740740{-
741741takeEndBy_ isEnd p =
@@ -747,7 +747,7 @@ takeEndBy_ isEnd p =
747747--
748748-- /Unimplemented/
749749{-# INLINE takeEitherSepBy #-}
750−takeEitherSepBy :: -- MonadCatch m =>
750+takeEitherSepBy :: -- Monad m =>
751751 (a -> Bool) -> Fold m (Either a b) c -> Parser m a c
752752takeEitherSepBy _cond = undefined -- D.toParserK . D.takeEitherSepBy cond
753753
@@ -776,7 +776,7 @@ takeEitherSepBy _cond = undefined -- D.toParserK . D.takeEitherSepBy cond
776776-- /Pre-release/
777777--
778778{-# INLINE takeStartBy #-}
779−takeStartBy :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
779+takeStartBy :: Monad m => (a -> Bool) -> Fold m a b -> Parser m a b
780780takeStartBy cond = D.toParserK . D.takeStartBy cond
781781
782782-- | Like 'takeStartBy' but drops the separator.
@@ -784,7 +784,7 @@ takeStartBy cond = D.toParserK . D.takeStartBy cond
784784-- >>> takeStartBy_ isBegin = Parser.takeFramedByGeneric Nothing (Just isBegin) Nothing
785785--
786786{-# INLINE takeStartBy_ #-}
787−takeStartBy_ :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
787+takeStartBy_ :: Monad m => (a -> Bool) -> Fold m a b -> Parser m a b
788788takeStartBy_ isBegin = takeFramedByGeneric Nothing (Just isBegin) Nothing
789789
790790-------------------------------------------------------------------------------
@@ -797,7 +797,7 @@ takeStartBy_ isBegin = takeFramedByGeneric Nothing (Just isBegin) Nothing
797797--
798798-- /pre-release/
799799{-# INLINE takeEndByEsc #-}
800−takeEndByEsc :: MonadCatch m =>
800+takeEndByEsc :: Monad m =>
801801 (a -> Bool) -> (a -> Bool) -> Parser m a b -> Parser m a b
802802takeEndByEsc isEsc isEnd p =
803803 D.toParserK $ D.takeEndByEsc isEsc isEnd (D.fromParserK p)
@@ -824,7 +824,7 @@ takeEndByEsc isEsc isEnd p =
824824--
825825-- /Pre-release/
826826{-# INLINE takeFramedByEsc_ #-}
827−takeFramedByEsc_ :: MonadCatch m =>
827+takeFramedByEsc_ :: Monad m =>
828828 (a -> Bool) -> (a -> Bool) -> (a -> Bool) -> Fold m a b -> Parser m a b
829829takeFramedByEsc_ isEsc isBegin isEnd f =
830830 D.toParserK $ D.takeFramedByEsc_ isEsc isBegin isEnd f
@@ -837,7 +837,7 @@ takeFramedByEsc_ isEsc isBegin isEnd f =
837837-- >>> takeFramedBy_ = Parser.takeFramedByEsc_ (const False)
838838--
839839{-# INLINE takeFramedBy_ #-}
840−takeFramedBy_ :: MonadCatch m =>
840+takeFramedBy_ :: Monad m =>
841841 (a -> Bool) -> (a -> Bool) -> Fold m a b -> Parser m a b
842842takeFramedBy_ isBegin isEnd f = D.toParserK $ D.takeFramedBy_ isBegin isEnd f
843843-- takeFramedBy_ isBegin isEnd =
@@ -867,7 +867,7 @@ takeFramedBy_ isBegin isEnd f = D.toParserK $ D.takeFramedBy_ isBegin isEnd f
867867-- @
868868--
869869{-# INLINE wordBy #-}
870−wordBy :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
870+wordBy :: Monad m => (a -> Bool) -> Fold m a b -> Parser m a b
871871wordBy f = D.toParserK . D.wordBy f
872872
873873-- | Like 'wordBy' but treats anything inside a pair of quotes as a single
@@ -891,7 +891,7 @@ wordBy f = D.toParserK . D.wordBy f
891891--
892892-- /Pre-release/
893893{-# INLINE wordFramedBy #-}
894−wordFramedBy :: MonadCatch m =>
894+wordFramedBy :: Monad m =>
895895 (a -> Bool) -- ^ Escape
896896 -> (a -> Bool) -- ^ left quote
897897 -> (a -> Bool) -- ^ right quote
@@ -922,7 +922,7 @@ wordFramedBy isEsc isBegin isEnd isSpc =
922922-- "a\"b'c\";'d\"e'f"
923923--
924924{-# INLINE wordQuotedBy #-}
925−wordQuotedBy :: (MonadCatch m, Eq a) =>
925+wordQuotedBy :: (Monad m, Eq a) =>
926926 Bool -- ^ keep the quotes in the output
927927 -> (a -> Bool) -- ^ Escape
928928 -> (a -> Bool) -- ^ left quote
@@ -963,7 +963,7 @@ wordQuotedBy keepQuotes isEsc isBegin isEnd toRight isSpc =
963963-- /Pre-release/
964964--
965965{-# INLINE groupBy #-}
966−groupBy :: MonadCatch m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
966+groupBy :: Monad m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
967967groupBy eq = D.toParserK . D.groupBy eq
968968
969969-- | Unlike 'groupBy' this combinator performs a rolling comparison of two
@@ -997,7 +997,7 @@ groupBy eq = D.toParserK . D.groupBy eq
997997-- /Pre-release/
998998--
999999{-# INLINE groupByRolling #-}
1000−groupByRolling :: MonadCatch m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
1000+groupByRolling :: Monad m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
10011001groupByRolling eq = D.toParserK . D.groupByRolling eq
10021002
10031003-- | Like 'groupByRolling', but if the predicate is 'True' then collects using
@@ -1011,7 +1011,7 @@ groupByRolling eq = D.toParserK . D.groupByRolling eq
10111011--
10121012-- /Unimplemented/
10131013{-# INLINE groupByRollingEither #-}
1014−groupByRollingEither :: MonadCatch m =>
1014+groupByRollingEither :: Monad m =>
10151015 (a -> a -> Bool) -> Fold m a b -> Fold m a c -> Parser m a (Either b c)
10161016groupByRollingEither eq f1 = D.toParserK . D.groupByRollingEither eq f1
10171017
@@ -1027,7 +1027,7 @@ groupByRollingEither eq f1 = D.toParserK . D.groupByRollingEither eq f1
10271027-- /Pre-release/
10281028--
10291029{-# INLINE eqBy #-}
1030−eqBy :: MonadCatch m => (a -> a -> Bool) -> [a] -> Parser m a ()
1030+eqBy :: Monad m => (a -> a -> Bool) -> [a] -> Parser m a ()
10311031eqBy cmp = D.toParserK . D.eqBy cmp
10321032
10331033-- | Match the input sequence with the supplied list and return it if
@@ -1035,7 +1035,7 @@ eqBy cmp = D.toParserK . D.eqBy cmp
10351035--
10361036-- /Pre-release/
10371037{-# INLINE list #-}
1038−list :: (MonadCatch m, Eq a) => [a] -> Parser m a [a]
1038+list :: (Monad m, Eq a) => [a] -> Parser m a [a]
10391039list xs = eqBy (==) xs $> xs
10401040
10411041-------------------------------------------------------------------------------
@@ -1085,7 +1085,7 @@ list xs = eqBy (==) xs $> xs
10851085-- /Pre-release/
10861086--
10871087{-# INLINE serialWith #-}
1088−serialWith :: MonadCatch m
1088+serialWith :: Monad m
10891089 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
10901090serialWith f p1 p2 =
10911091 D.toParserK $ D.serialWith f (D.fromParserK p1) (D.fromParserK p2)
@@ -1111,7 +1111,7 @@ serialWith f p1 p2 =
11111111-- /Pre-release/
11121112--
11131113{-# INLINE split_ #-}
1114−split_ :: MonadCatch m => Parser m x a -> Parser m x b -> Parser m x b
1114+split_ :: Monad m => Parser m x a -> Parser m x b -> Parser m x b
11151115split_ p1 p2 = D.toParserK $ D.split_ (D.fromParserK p1) (D.fromParserK p2)
11161116
11171117{-
@@ -1122,7 +1122,7 @@ split_ p1 p2 = D.toParserK $ D.split_ (D.fromParserK p1) (D.fromParserK p2)
11221122-- /Pre-release/
11231123--
11241124{-# INLINE teeWith #-}
1125−teeWith :: MonadCatch m
1125+teeWith :: Monad m
11261126 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
11271127teeWith f p1 p2 =
11281128 D.toParserK $ D.teeWith f (D.fromParserK p1) (D.fromParserK p2)
@@ -1133,7 +1133,7 @@ teeWith f p1 p2 =
11331133-- /Pre-release/
11341134--
11351135{-# INLINE teeWithFst #-}
1136−teeWithFst :: MonadCatch m
1136+teeWithFst :: Monad m
11371137 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
11381138teeWithFst f p1 p2 =
11391139 D.toParserK $ D.teeWithFst f (D.fromParserK p1) (D.fromParserK p2)
@@ -1144,7 +1144,7 @@ teeWithFst f p1 p2 =
11441144-- /Unimplemented/
11451145--
11461146{-# INLINE teeWithMin #-}
1147−teeWithMin :: MonadCatch m
1147+teeWithMin :: Monad m
11481148 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
11491149teeWithMin f p1 p2 =
11501150 D.toParserK $ D.teeWithMin f (D.fromParserK p1) (D.fromParserK p2)
@@ -1168,7 +1168,7 @@ teeWithMin f p1 p2 =
11681168-- /Pre-release/
11691169--
11701170{-# INLINE alt #-}
1171−alt :: MonadCatch m => Parser m x a -> Parser m x a -> Parser m x a
1171+alt :: Monad m => Parser m x a -> Parser m x a -> Parser m x a
11721172alt p1 p2 = D.toParserK $ D.alt (D.fromParserK p1) (D.fromParserK p2)
11731173
11741174{-
@@ -1179,7 +1179,7 @@ alt p1 p2 = D.toParserK $ D.alt (D.fromParserK p1) (D.fromParserK p2)
11791179-- /Pre-release/
11801180--
11811181{-# INLINE shortest #-}
1182−shortest :: MonadCatch m
1182+shortest :: Monad m
11831183 => Parser m x a -> Parser m x a -> Parser m x a
11841184shortest p1 p2 = D.toParserK $ D.shortest (D.fromParserK p1) (D.fromParserK p2)
11851185
@@ -1190,7 +1190,7 @@ shortest p1 p2 = D.toParserK $ D.shortest (D.fromParserK p1) (D.fromParserK p2)
11901190-- /Pre-release/
11911191--
11921192{-# INLINE longest #-}
1193−longest :: MonadCatch m
1193+longest :: Monad m
11941194 => Parser m x a -> Parser m x a -> Parser m x a
11951195longest p1 p2 = D.toParserK $ D.longest (D.fromParserK p1) (D.fromParserK p2)
11961196-}
@@ -1200,7 +1200,7 @@ longest p1 p2 = D.toParserK $ D.longest (D.fromParserK p1) (D.fromParserK p2)
12001200-- /Pre-release/
12011201--
12021202{-# INLINE lookAhead #-}
1203−lookAhead :: MonadCatch m => Parser m a b -> Parser m a b
1203+lookAhead :: Monad m => Parser m a b -> Parser m a b
12041204lookAhead p = D.toParserK $ D.lookAhead $ D.fromParserK p
12051205
12061206-- | Takes at-most @n@ input elements.
@@ -1216,7 +1216,7 @@ lookAhead p = D.toParserK $ D.lookAhead $ D.fromParserK p
12161216--
12171217-- /Internal/
12181218{-# INLINE takeP #-}
1219−takeP :: MonadCatch m => Int -> Parser m a b -> Parser m a b
1219+takeP :: Monad m => Int -> Parser m a b -> Parser m a b
12201220takeP i p = D.toParserK $ D.takeP i $ D.fromParserK p
12211221
12221222-------------------------------------------------------------------------------
@@ -1234,7 +1234,7 @@ takeP i p = D.toParserK $ D.takeP i $ D.fromParserK p
12341234--
12351235{-# INLINE concatSequence #-}
12361236concatSequence ::
1237− MonadCatch m =>
1237+ Monad m =>
12381238 Fold m b c -> Stream m (Parser m a b) -> Parser m a c
12391239concatSequence f p =
12401240 let sp = fmap D.fromParserK $ Stream.toStreamD p
@@ -1250,7 +1250,7 @@ concatSequence f p =
12501250-- /Pre-release/
12511251--
12521252{-# INLINE concatMap #-}
1253−concatMap :: MonadCatch m
1253+concatMap :: Monad m
12541254 => (b -> Parser m a c) -> Parser m a b -> Parser m a c
12551255concatMap f p = D.toParserK $ D.concatMap (D.fromParserK . f) (D.fromParserK p)
12561256
@@ -1268,7 +1268,7 @@ concatMap f p = D.toParserK $ D.concatMap (D.fromParserK . f) (D.fromParserK p)
12681268--
12691269{-# INLINE choice #-}
12701270choice ::
1271− (Functor t, Foldable t, MonadCatch m) => t (Parser m a b) -> Parser m a b
1271+ (Functor t, Foldable t, Monad m) => t (Parser m a b) -> Parser m a b
12721272choice ps = D.toParserK $ D.choice $ D.fromParserK <$> ps
12731273-}
12741274
@@ -1282,7 +1282,7 @@ choice ps = D.toParserK $ D.choice $ D.fromParserK <$> ps
12821282-- /Unimplemented/
12831283--
12841284{-# INLINE manyP #-}
1285−manyP :: -- MonadCatch m =>
1285+manyP :: -- Monad m =>
12861286 Parser m a b -> Parser m b c -> Parser m a c
12871287manyP _p _f = undefined -- D.toParserK $ D.manyP (D.fromParserK p) f
12881288
@@ -1299,7 +1299,7 @@ manyP _p _f = undefined -- D.toParserK $ D.manyP (D.fromParserK p) f
12991299-- /Pre-release/
13001300--
13011301{-# INLINE many #-}
1302−many :: MonadCatch m => Parser m a b -> Fold m b c -> Parser m a c
1302+many :: Monad m => Parser m a b -> Fold m b c -> Parser m a c
13031303many p f = D.toParserK $ D.many (D.fromParserK p) f
13041304
13051305-- Note: many1 would perhaps be a better name for this and consistent with
@@ -1320,7 +1320,7 @@ many p f = D.toParserK $ D.many (D.fromParserK p) f
13201320-- /Pre-release/
13211321--
13221322{-# INLINE some #-}
1323−some :: MonadCatch m => Parser m a b -> Fold m b c -> Parser m a c
1323+some :: Monad m => Parser m a b -> Fold m b c -> Parser m a c
13241324some p f = D.toParserK $ D.some (D.fromParserK p) f
13251325-- some p f = manyP p (takeGE 1 f)
13261326-- some = countBetween 1 maxBound
@@ -1334,7 +1334,7 @@ some p f = D.toParserK $ D.some (D.fromParserK p) f
13341334-- /Unimplemented/
13351335--
13361336{-# INLINE countBetween #-}
1337−countBetween :: -- MonadCatch m =>
1337+countBetween :: -- Monad m =>
13381338 Int -> Int -> Parser m a b -> Fold m b c -> Parser m a c
13391339countBetween _m _n _p = undefined
13401340-- countBetween m n p f = manyP p (takeBetween m n f)
@@ -1349,7 +1349,7 @@ countBetween _m _n _p = undefined
13491349-- /Unimplemented/
13501350--
13511351{-# INLINE count #-}
1352−count :: -- MonadCatch m =>
1352+count :: -- Monad m =>
13531353 Int -> Parser m a b -> Fold m b c -> Parser m a c
13541354count n = countBetween n n
13551355-- count n p f = manyP p (takeEQ n f)
@@ -1366,7 +1366,7 @@ count n = countBetween n n
13661366-- /Unimplemented/
13671367--
13681368{-# INLINE manyTillP #-}
1369−manyTillP :: -- MonadCatch m =>
1369+manyTillP :: -- Monad m =>
13701370 Parser m a b -> Parser m a x -> Parser m b c -> Parser m a c
13711371manyTillP _p1 _p2 _f = undefined
13721372 -- D.toParserK $ D.manyTillP (D.fromParserK p1) (D.fromParserK p2) f
@@ -1382,7 +1382,7 @@ manyTillP _p1 _p2 _f = undefined
13821382-- /Pre-release/
13831383--
13841384{-# INLINE manyTill #-}
1385−manyTill :: MonadCatch m
1385+manyTill :: Monad m
13861386 => Parser m a b -> Parser m a x -> Fold m b c -> Parser m a c
13871387manyTill p1 p2 f =
13881388 D.toParserK $ D.manyTill f (D.fromParserK p1) (D.fromParserK p2)
@@ -1398,7 +1398,7 @@ manyTill p1 p2 f =
13981398-- /Unimplemented/
13991399--
14001400{-# INLINE manyThen #-}
1401−manyThen :: -- (Foldable t, MonadCatch m) =>
1401+manyThen :: -- (Foldable t, Monad m) =>
14021402 Parser m a b -> Parser m a x -> Fold m b c -> Parser m a c
14031403manyThen _parser _recover _f = undefined
14041404
@@ -1432,7 +1432,7 @@ manyThen _parser _recover _f = undefined
14321432-- /Pre-release/
14331433--
14341434{-# INLINE deintercalate #-}
1435−deintercalate :: MonadCatch m =>
1435+deintercalate :: Monad m =>
14361436 Fold m (Either x y) z
14371437 -> Parser m a x
14381438 -> Parser m a y
@@ -1449,7 +1449,7 @@ deintercalate sink contentL contentR =
14491449-- input. Detection of that would make the implementation more complex.
14501450--
14511451{-# INLINE sepBy1 #-}
1452−sepBy1 :: MonadCatch m =>
1452+sepBy1 :: Monad m =>
14531453 Fold m b c -> Parser m a b -> Parser m a x -> Parser m a c
14541454sepBy1 sink p sep = do
14551455 x <- p
@@ -1465,7 +1465,7 @@ sepBy1 sink p sep = do
14651465-- >>> sepBy sink content sep = Parser.sepBy1 sink content sep <|> return mempty
14661466--
14671467{-# INLINE sepBy #-}
1468−sepBy :: MonadCatch m =>
1468+sepBy :: Monad m =>
14691469 Fold m b c -> Parser m a b -> Parser m a x -> Parser m a c
14701470sepBy sink content sep =
14711471 D.toParserK $ D.sepBy sink (D.fromParserK content) (D.fromParserK sep)
@@ -1482,7 +1482,7 @@ sepBy sink content sep =
14821482-- /Unimplemented/
14831483--
14841484{-# INLINE roundRobin #-}
1485−roundRobin :: -- (Foldable t, MonadCatch m) =>
1485+roundRobin :: -- (Foldable t, Monad m) =>
14861486 t (Parser m a b) -> Fold m b c -> Parser m a c
14871487roundRobin _ps _f = undefined
14881488
@@ -1497,7 +1497,7 @@ roundRobin _ps _f = undefined
14971497-- /Unimplemented/
14981498--
14991499{-# INLINE retryMaxTotal #-}
1500−retryMaxTotal :: -- (MonadCatch m) =>
1500+retryMaxTotal :: -- (Monad m) =>
15011501 Int -> Parser m a b -> Fold m b c -> Parser m a c
15021502retryMaxTotal _n _p _f = undefined
15031503
@@ -1506,7 +1506,7 @@ retryMaxTotal _n _p _f = undefined
15061506-- /Unimplemented/
15071507--
15081508{-# INLINE retryMaxSuccessive #-}
1509−retryMaxSuccessive :: -- (MonadCatch m) =>
1509+retryMaxSuccessive :: -- (Monad m) =>
15101510 Int -> Parser m a b -> Fold m b c -> Parser m a c
15111511retryMaxSuccessive _n _p _f = undefined
15121512
@@ -1517,6 +1517,6 @@ retryMaxSuccessive _n _p _f = undefined
15171517-- /Unimplemented/
15181518--
15191519{-# INLINE retry #-}
1520−retry :: -- (MonadCatch m) =>
1520+retry :: -- (Monad m) =>
15211521 Parser m a b -> Parser m a b
15221522retry _p = undefined