module Streamly.Internal.Data.Array.Generic
(
module Streamly.Internal.Data.Array.Generic.Type
, parse
, parsePos
, parseBreak
, parseBreakPos
)
where
import Streamly.Internal.Data.Parser (ParseError(..), ParseErrorPos(..))
import Streamly.Internal.Data.StreamK.Type (StreamK)
import qualified Streamly.Internal.Data.ParserDrivers as Drivers
import qualified Streamly.Internal.Data.ParserK.Type as ParserK
import Prelude hiding (Foldable(..), read)
import Streamly.Internal.Data.Array.Generic.Type
{-# INLINE parseBreak #-}
parseBreak
:: forall m a b. Monad m
=> ParserK.ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseError b, StreamK m (Array a))
parseBreak :: forall (m :: * -> *) a b.
Monad m =>
ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseError b, StreamK m (Array a))
parseBreak = ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseError b, StreamK m (Array a))
forall (m :: * -> *) a b.
Monad m =>
ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseError b, StreamK m (Array a))
Drivers.parseBreakChunksGeneric
{-# INLINE parseBreakPos #-}
parseBreakPos
:: forall m a b. Monad m
=> ParserK.ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseErrorPos b, StreamK m (Array a))
parseBreakPos :: forall (m :: * -> *) a b.
Monad m =>
ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseErrorPos b, StreamK m (Array a))
parseBreakPos = ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseErrorPos b, StreamK m (Array a))
forall (m :: * -> *) a b.
Monad m =>
ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseErrorPos b, StreamK m (Array a))
Drivers.parseBreakChunksGenericPos
{-# INLINE parse #-}
parse ::
(Monad m)
=> ParserK.ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseError b)
parse :: forall (m :: * -> *) a b.
Monad m =>
ParserK (Array a) m b
-> StreamK m (Array a) -> m (Either ParseError b)
parse ParserK (Array a) m b
f = ((Either ParseError b, StreamK m (Array a)) -> Either ParseError b)
-> m (Either ParseError b, StreamK m (Array a))
-> m (Either ParseError b)
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Either ParseError b, StreamK m (Array a)) -> Either ParseError b
forall a b. (a, b) -> a
fst (m (Either ParseError b, StreamK m (Array a))
-> m (Either ParseError b))
-> (StreamK m (Array a)
-> m (Either ParseError b, StreamK m (Array a)))
-> StreamK m (Array a)
-> m (Either ParseError b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseError b, StreamK m (Array a))
forall (m :: * -> *) a b.
Monad m =>
ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseError b, StreamK m (Array a))
parseBreak ParserK (Array a) m b
f
{-# INLINE parsePos #-}
parsePos ::
(Monad m)
=> ParserK.ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseErrorPos b)
parsePos :: forall (m :: * -> *) a b.
Monad m =>
ParserK (Array a) m b
-> StreamK m (Array a) -> m (Either ParseErrorPos b)
parsePos ParserK (Array a) m b
f = ((Either ParseErrorPos b, StreamK m (Array a))
-> Either ParseErrorPos b)
-> m (Either ParseErrorPos b, StreamK m (Array a))
-> m (Either ParseErrorPos b)
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Either ParseErrorPos b, StreamK m (Array a))
-> Either ParseErrorPos b
forall a b. (a, b) -> a
fst (m (Either ParseErrorPos b, StreamK m (Array a))
-> m (Either ParseErrorPos b))
-> (StreamK m (Array a)
-> m (Either ParseErrorPos b, StreamK m (Array a)))
-> StreamK m (Array a)
-> m (Either ParseErrorPos b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseErrorPos b, StreamK m (Array a))
forall (m :: * -> *) a b.
Monad m =>
ParserK (Array a) m b
-> StreamK m (Array a)
-> m (Either ParseErrorPos b, StreamK m (Array a))
parseBreakPos ParserK (Array a) m b
f