on master help sign in
Remove redundant MonadCatch/MonadThrow constraints
ec94487Harendra Kumar
core/src/Streamly/Internal/Data/Array/Mut/Stream.hs+1−1
@@ -204,7 +204,7 @@ compact n = Stream.fromStreamD . packArraysChunksOf n . Stream.toStreamD
204-- /Internal/
204-- /Internal/
205{-# INLINE_NORMAL compactLEParserD #-}
205{-# INLINE_NORMAL compactLEParserD #-}
206compactLEParserD ::
206compactLEParserD ::
207− forall m a. (MonadThrow m, MonadIO m, Unbox a)
207+ forall m a. (MonadIO m, Unbox a)
208 => Int -> ParserD.Parser (Array a) m (Array a)
208 => Int -> ParserD.Parser (Array a) m (Array a)
209compactLEParserD n = ParserD.Parser step initial extract
209compactLEParserD n = ParserD.Parser step initial extract
210
210
core/src/Streamly/Internal/Data/Fold/Chunked.hs+7−8
@@ -58,7 +58,6 @@ where
58
58
59import Control.Applicative (liftA2)
59import Control.Applicative (liftA2)
60import Control.Exception (assert)
60import Control.Exception (assert)
61−import Control.Monad.Catch (MonadThrow)
62import Control.Monad.IO.Class (MonadIO(..))
61import Control.Monad.IO.Class (MonadIO(..))
63import Data.Bifunctor (first)
62import Data.Bifunctor (first)
64import Streamly.Internal.Data.Unboxed (peekWith, sizeOf, Unbox)
63import Streamly.Internal.Data.Unboxed (peekWith, sizeOf, Unbox)
@@ -187,9 +186,9 @@ fromParserD (ParserD.Parser step1 initial1 extract1) =
187-- /Pre-release/
186-- /Pre-release/
188{-# INLINE fromParser #-}
187{-# INLINE fromParser #-}
189#ifdef DEVBUILD
188#ifdef DEVBUILD
190−fromParser :: forall m a b. (MonadThrow m, MonadIO m) =>
189+fromParser :: forall m a b. (MonadIO m) =>
191#else
190#else
192−fromParser :: forall m a b. (MonadThrow m, MonadIO m, Unbox a) =>
191+fromParser :: forall m a b. (MonadIO m, Unbox a) =>
193#endif
192#endif
194 Parser.Parser a m b -> ChunkFold m a b
193 Parser.Parser a m b -> ChunkFold m a b
195fromParser = fromParserD . ParserD.fromParserK
194fromParser = fromParserD . ParserD.fromParserK
@@ -246,7 +245,7 @@ fromEffect = ChunkFold . ParserD.fromEffect
246--
245--
247-- /Pre-release/
246-- /Pre-release/
248{-# INLINE split_ #-}
247{-# INLINE split_ #-}
249−split_ :: MonadThrow m =>
248+split_ :: Monad m =>
250 ChunkFold m x a -> ChunkFold m x b -> ChunkFold m x b
249 ChunkFold m x a -> ChunkFold m x b -> ChunkFold m x b
251split_ (ChunkFold p1) (ChunkFold p2) =
250split_ (ChunkFold p1) (ChunkFold p2) =
252 ChunkFold $ ParserD.noErrorUnsafeSplit_ p1 p2
251 ChunkFold $ ParserD.noErrorUnsafeSplit_ p1 p2
@@ -256,14 +255,14 @@ split_ (ChunkFold p1) (ChunkFold p2) =
256--
255--
257-- /Pre-release/
256-- /Pre-release/
258{-# INLINE splitWith #-}
257{-# INLINE splitWith #-}
259−splitWith :: MonadThrow m
258+splitWith :: Monad m
260 => (a -> b -> c) -> ChunkFold m x a -> ChunkFold m x b -> ChunkFold m x c
259 => (a -> b -> c) -> ChunkFold m x a -> ChunkFold m x b -> ChunkFold m x c
261splitWith f (ChunkFold p1) (ChunkFold p2) =
260splitWith f (ChunkFold p1) (ChunkFold p2) =
262 ChunkFold $ ParserD.noErrorUnsafeSplitWith f p1 p2
261 ChunkFold $ ParserD.noErrorUnsafeSplitWith f p1 p2
263
262
264-- | 'Applicative' form of 'splitWith'.
263-- | 'Applicative' form of 'splitWith'.
265-- > (<*>) = splitWith id
264-- > (<*>) = splitWith id
266−instance MonadThrow m => Applicative (ChunkFold m a) where
265+instance Monad m => Applicative (ChunkFold m a) where
267 {-# INLINE pure #-}
266 {-# INLINE pure #-}
268 pure = fromPure
267 pure = fromPure
269
268
@@ -288,7 +287,7 @@ instance MonadThrow m => Applicative (ChunkFold m a) where
288-- /Pre-release/
287-- /Pre-release/
289--
288--
290{-# INLINE concatMap #-}
289{-# INLINE concatMap #-}
291−concatMap :: MonadThrow m =>
290+concatMap :: Monad m =>
292 (b -> ChunkFold m a c) -> ChunkFold m a b -> ChunkFold m a c
291 (b -> ChunkFold m a c) -> ChunkFold m a b -> ChunkFold m a c
293concatMap func (ChunkFold p) =
292concatMap func (ChunkFold p) =
294 let f x = let ChunkFold y = func x in y
293 let f x = let ChunkFold y = func x in y
@@ -298,7 +297,7 @@ concatMap func (ChunkFold p) =
298-- output of the previous fold. See 'concatMap'.
297-- output of the previous fold. See 'concatMap'.
299--
298--
300-- > (>>=) = flip concatMap
299-- > (>>=) = flip concatMap
301−instance MonadThrow m => Monad (ChunkFold m a) where
300+instance Monad m => Monad (ChunkFold m a) where
302 {-# INLINE return #-}
301 {-# INLINE return #-}
303 return = pure
302 return = pure
304
303
core/src/Streamly/Internal/Data/Stream/Top.hs+2−2
@@ -42,7 +42,7 @@ where
42
42
43#include "inline.hs"
43#include "inline.hs"
44
44
45−import Control.Monad.Catch (MonadCatch)
45+import Control.Monad.Catch (MonadThrow)
46import Control.Monad.IO.Class (MonadIO(..))
46import Control.Monad.IO.Class (MonadIO(..))
47import Control.Monad.Trans.Class (lift)
47import Control.Monad.Trans.Class (lift)
48import Control.Monad.Trans.State.Strict (get, put)
48import Control.Monad.Trans.State.Strict (get, put)
@@ -111,7 +111,7 @@ sampleFromThen offset stride =
111-- /Pre-release/
111-- /Pre-release/
112--
112--
113{-# INLINE sortBy #-}
113{-# INLINE sortBy #-}
114−sortBy :: MonadCatch m => (a -> a -> Ordering) -> Stream m a -> Stream m a
114+sortBy :: MonadThrow m => (a -> a -> Ordering) -> Stream m a -> Stream m a
115-- sortBy f = Stream.concatPairsWith (Stream.mergeBy f) Stream.fromPure
115-- sortBy f = Stream.concatPairsWith (Stream.mergeBy f) Stream.fromPure
116sortBy cmp =
116sortBy cmp =
117 let p =
117 let p =
core/src/Streamly/Internal/Unicode/Stream.hs+3−4
@@ -85,7 +85,6 @@ where
85#include "inline.hs"
85#include "inline.hs"
86
86
87import Control.Monad (void)
87import Control.Monad (void)
88−import Control.Monad.Catch (MonadThrow(..), MonadCatch)
89import Control.Monad.IO.Class (MonadIO, liftIO)
88import Control.Monad.IO.Class (MonadIO, liftIO)
90import Data.Bits (shiftR, shiftL, (.|.), (.&.))
89import Data.Bits (shiftR, shiftL, (.|.), (.&.))
91import Data.Char (chr, ord)
90import Data.Char (chr, ord)
@@ -453,7 +452,7 @@ data UTF8CharDecodeState a
453
452
454{-# INLINE parseCharUtf8WithD #-}
453{-# INLINE parseCharUtf8WithD #-}
455parseCharUtf8WithD ::
454parseCharUtf8WithD ::
456− MonadThrow m => CodingFailureMode -> ParserD.Parser Word8 m Char
455+ Monad m => CodingFailureMode -> ParserD.Parser Word8 m Char
457parseCharUtf8WithD cfm = ParserD.Parser (step' utf8d) initial extract
456parseCharUtf8WithD cfm = ParserD.Parser (step' utf8d) initial extract
458
457
459 where
458 where
@@ -526,7 +525,7 @@ parseCharUtf8WithD cfm = ParserD.Parser (step' utf8d) initial extract
526-- workflow requires backtracking 1 element. This can be revisited once "Fold"
525-- workflow requires backtracking 1 element. This can be revisited once "Fold"
527-- supports backtracking.
526-- supports backtracking.
528{-# INLINE writeCharUtf8' #-}
527{-# INLINE writeCharUtf8' #-}
529−writeCharUtf8' :: MonadThrow m => Fold m Word8 Char
528+writeCharUtf8' :: Monad m => Fold m Word8 Char
530writeCharUtf8' = ParserD.toFold (parseCharUtf8WithD ErrorOnCodingFailure)
529writeCharUtf8' = ParserD.toFold (parseCharUtf8WithD ErrorOnCodingFailure)
531
530
532-- XXX The initial idea was to have "parseCharUtf8" and offload the error
531-- XXX The initial idea was to have "parseCharUtf8" and offload the error
@@ -541,7 +540,7 @@ writeCharUtf8' = ParserD.toFold (parseCharUtf8WithD ErrorOnCodingFailure)
541-- This needs to be investigated futher.
540-- This needs to be investigated futher.
542{-# INLINE parseCharUtf8With #-}
541{-# INLINE parseCharUtf8With #-}
543parseCharUtf8With ::
542parseCharUtf8With ::
544− MonadCatch m => CodingFailureMode -> Parser.Parser Word8 m Char
543+ Monad m => CodingFailureMode -> Parser.Parser Word8 m Char
545parseCharUtf8With = ParserD.toParserK . parseCharUtf8WithD
544parseCharUtf8With = ParserD.toParserK . parseCharUtf8WithD
546
545
547-- XXX write it as a parser and use parseMany to decode a stream, need to check
546-- XXX write it as a parser and use parseMany to decode a stream, need to check
core/src/Streamly/Internal/Unicode/String.hs+2−3
@@ -35,7 +35,6 @@ module Streamly.Internal.Unicode.String
35 ) where
35 ) where
36
36
37import Control.Applicative (Alternative(..))
37import Control.Applicative (Alternative(..))
38−import Control.Monad.Catch (MonadCatch)
39import Streamly.Internal.Data.Parser (Parser)
38import Streamly.Internal.Data.Parser (Parser)
40
39
41import Language.Haskell.TH
40import Language.Haskell.TH
@@ -61,12 +60,12 @@ data StrSegment
61 | StrVar String
60 | StrVar String
62 deriving (Show, Eq)
61 deriving (Show, Eq)
63
62
64−haskellIdentifier :: MonadCatch m => Parser Char m String
63+haskellIdentifier :: Monad m => Parser Char m String
65haskellIdentifier =
64haskellIdentifier =
66 let p = Parser.alphaNum <|> Parser.char '\'' <|> Parser.char '_'
65 let p = Parser.alphaNum <|> Parser.char '\'' <|> Parser.char '_'
67 in Parser.some p Fold.toList
66 in Parser.some p Fold.toList
68
67
69−strParser :: MonadCatch m => Parser Char m [StrSegment]
68+strParser :: Monad m => Parser Char m [StrSegment]
70strParser = Parser.many content Fold.toList
69strParser = Parser.many content Fold.toList
71
70
72 where
71 where