on master help sign in
Remove redundant MonadThrow from ParserD
c44c370Harendra Kumar
core/src/Streamly/Internal/Data/Parser/ParserD.hs+8−8
@@ -408,7 +408,7 @@ next = Parser step initial extract
408-- /Pre-release/
408-- /Pre-release/
409--
409--
410{-# INLINE either #-}
410{-# INLINE either #-}
411−either :: MonadThrow m => (a -> Either String b) -> Parser m a b
411+either :: Monad m => (a -> Either String b) -> Parser m a b
412either f = Parser step initial extract
412either f = Parser step initial extract
413
413
414 where
414 where
@@ -430,7 +430,7 @@ either f = Parser step initial extract
430-- /Pre-release/
430-- /Pre-release/
431--
431--
432{-# INLINE maybe #-}
432{-# INLINE maybe #-}
433−maybe :: MonadThrow m => (a -> Maybe b) -> Parser m a b
433+maybe :: Monad m => (a -> Maybe b) -> Parser m a b
434-- maybe f = either (Maybe.maybe (Left "maybe: predicate failed") Right . f)
434-- maybe f = either (Maybe.maybe (Left "maybe: predicate failed") Right . f)
435maybe parserF = Parser step initial extract
435maybe parserF = Parser step initial extract
436
436
@@ -453,7 +453,7 @@ maybe parserF = Parser step initial extract
453-- /Pre-release/
453-- /Pre-release/
454--
454--
455{-# INLINE satisfy #-}
455{-# INLINE satisfy #-}
456−satisfy :: MonadThrow m => (a -> Bool) -> Parser m a a
456+satisfy :: Monad m => (a -> Bool) -> Parser m a a
457-- satisfy predicate = maybe (\a -> if predicate a then Just a else Nothing)
457-- satisfy predicate = maybe (\a -> if predicate a then Just a else Nothing)
458satisfy predicate = Parser step initial extract
458satisfy predicate = Parser step initial extract
459
459
@@ -1567,7 +1567,7 @@ postscan :: -- Monad m =>
1567postscan = undefined
1567postscan = undefined
1568
1568
1569{-# INLINE zipWithM #-}
1569{-# INLINE zipWithM #-}
1570−zipWithM :: MonadThrow m =>
1570+zipWithM :: Monad m =>
1571 (a -> b -> m c) -> D.Stream m a -> Fold m c x -> Parser m b x
1571 (a -> b -> m c) -> D.Stream m a -> Fold m c x -> Parser m b x
1572zipWithM zf (D.Stream sstep state) (Fold fstep finitial fextract) =
1572zipWithM zf (D.Stream sstep state) (Fold fstep finitial fextract) =
1573 Parser step initial extract
1573 Parser step initial extract
@@ -1623,14 +1623,14 @@ zipWithM zf (D.Stream sstep state) (Fold fstep finitial fextract) =
1623-- /Pre-release/
1623-- /Pre-release/
1624--
1624--
1625{-# INLINE zip #-}
1625{-# INLINE zip #-}
1626−zip :: MonadThrow m => D.Stream m a -> Fold m (a, b) x -> Parser m b x
1626+zip :: Monad m => D.Stream m a -> Fold m (a, b) x -> Parser m b x
1627zip = zipWithM (curry return)
1627zip = zipWithM (curry return)
1628
1628
1629-- | Pair each element of a fold input with its index, starting from index 0.
1629-- | Pair each element of a fold input with its index, starting from index 0.
1630--
1630--
1631-- /Pre-release/
1631-- /Pre-release/
1632{-# INLINE indexed #-}
1632{-# INLINE indexed #-}
1633−indexed :: forall m a b. MonadThrow m => Fold m (Int, a) b -> Parser m a b
1633+indexed :: forall m a b. Monad m => Fold m (Int, a) b -> Parser m a b
1634indexed = zip (D.enumerateFromIntegral 0 :: D.Stream m Int)
1634indexed = zip (D.enumerateFromIntegral 0 :: D.Stream m Int)
1635
1635
1636-- | @makeIndexFilter indexer filter predicate@ generates a fold filtering
1636-- | @makeIndexFilter indexer filter predicate@ generates a fold filtering
@@ -1659,7 +1659,7 @@ makeIndexFilter f comb g = f . comb g . FL.lmap snd
1659--
1659--
1660-- /Pre-release/
1660-- /Pre-release/
1661{-# INLINE sampleFromthen #-}
1661{-# INLINE sampleFromthen #-}
1662−sampleFromthen :: MonadThrow m => Int -> Int -> Fold m a b -> Parser m a b
1662+sampleFromthen :: Monad m => Int -> Int -> Fold m a b -> Parser m a b
1663sampleFromthen offset size =
1663sampleFromthen offset size =
1664 makeIndexFilter indexed FL.filter (\(i, _) -> (i + offset) `mod` size == 0)
1664 makeIndexFilter indexed FL.filter (\(i, _) -> (i + offset) `mod` size == 0)
1665
1665
@@ -2163,7 +2163,7 @@ data ManyTillState fs sr sl
2163-- /Pre-release/
2163-- /Pre-release/
2164--
2164--
2165{-# INLINE manyTill #-}
2165{-# INLINE manyTill #-}
2166−manyTill :: MonadThrow m
2166+manyTill :: Monad m
2167 => Fold m b c -> Parser m a b -> Parser m a x -> Parser m a c
2167 => Fold m b c -> Parser m a b -> Parser m a x -> Parser m a c
2168manyTill (Fold fstep finitial fextract)
2168manyTill (Fold fstep finitial fextract)
2169 (Parser stepL initialL extractL)
2169 (Parser stepL initialL extractL)