@@ -27,9 +27,9 @@ module Streamly.Internal.Data.Parser.ParserK.Type
2727 , Input (..)
2828 , ParseResult (..)
2929 , ParserK (..)
30− , fromParser
31− , fromParserSingular
32− , fromParserGeneric
30+ , adaptC
31+ , adapt
32+ , adaptCG
3333 -- , toParser
3434 , fromPure
3535 , fromEffect
@@ -380,8 +380,8 @@ instance MonadTrans (ParserK a) where
380380-- Chunked
381381--------------------------------------------------------------------------------
382382
383−{-# INLINE parseDToK #-}
384−parseDToK
383+{-# INLINE adaptCWith #-}
384+adaptCWith
385385 :: forall m a s b r. (Monad m, Unbox a)
386386 => (s -> a -> m (ParserD.Step s b))
387387 -> m (ParserD.Initial s b)
@@ -391,7 +391,7 @@ parseDToK
391391 -> Int
392392 -> Input (Array a)
393393 -> m (Step (Array a) m r)
394−parseDToK pstep initial extract cont !offset0 !usedCount !input = do
394+adaptCWith pstep initial extract cont !offset0 !usedCount !input = do
395395 res <- initial
396396 case res of
397397 ParserD.IPartial pst -> do
@@ -495,7 +495,7 @@ parseDToK pstep initial extract cont !offset0 !usedCount !input = do
495495 -- XXX It is called only when there is no input arr. So using 0
496496 -- as the position is correct?
497497 cont (Failure 0 err) count None
498− ParserD.Partial _ _ -> error "Bug: parseDToK Partial unreachable"
498+ ParserD.Partial _ _ -> error "Bug: adaptCWith Partial unreachable"
499499
500500 -- XXX Maybe we can use two separate continuations instead of using
501501 -- Just/Nothing cases here. That may help in avoiding the parseContJust
@@ -508,17 +508,17 @@ parseDToK pstep initial extract cont !offset0 !usedCount !input = do
508508--
509509-- /Pre-release/
510510--
511−{-# INLINE_LATE fromParser #-}
512−fromParser :: (Monad m, Unbox a) => ParserD.Parser a m b -> ParserK (Array a) m b
513−fromParser (ParserD.Parser step initial extract) =
514− MkParser $ parseDToK step initial extract
511+{-# INLINE_LATE adaptC #-}
512+adaptC :: (Monad m, Unbox a) => ParserD.Parser a m b -> ParserK (Array a) m b
513+adaptC (ParserD.Parser step initial extract) =
514+ MkParser $ adaptCWith step initial extract
515515
516516--------------------------------------------------------------------------------
517517-- Singular
518518--------------------------------------------------------------------------------
519519
520−{-# INLINE parseDToKSingular #-}
521−parseDToKSingular
520+{-# INLINE adaptWith #-}
521+adaptWith
522522 :: forall m a s b r. (Monad m)
523523 => (s -> a -> m (ParserD.Step s b))
524524 -> m (ParserD.Initial s b)
@@ -528,7 +528,7 @@ parseDToKSingular
528528 -> Int
529529 -> Input a
530530 -> m (Step a m r)
531−parseDToKSingular pstep initial extract cont !relPos !usedCount !input = do
531+adaptWith pstep initial extract cont !relPos !usedCount !input = do
532532 res <- initial
533533 case res of
534534 ParserD.IPartial pst -> do
@@ -597,7 +597,7 @@ parseDToKSingular pstep initial extract cont !relPos !usedCount !input = do
597597 -- XXX It is called only when there is no input arr. So using 0
598598 -- as the position is correct?
599599 cont (Failure 0 err) count None
600− ParserD.Partial _ _ -> error "Bug: parseDToK Partial unreachable"
600+ ParserD.Partial _ _ -> error "Bug: adaptCWith Partial unreachable"
601601
602602 -- XXX Maybe we can use two separate continuations instead of using
603603 -- Just/Nothing cases here. That may help in avoiding the parseContJust
@@ -606,19 +606,19 @@ parseDToKSingular pstep initial extract cont !relPos !usedCount !input = do
606606 parseCont !cnt !pst (Chunk arr) = parseContChunk cnt pst arr
607607 parseCont !cnt !pst None = parseContNothing cnt pst
608608
609−-- | Similar to "fromParser" but for singular elements.
609+-- | Similar to "adaptC" but for non-chunked input.
610610--
611−{-# INLINE_LATE fromParserSingular #-}
612−fromParserSingular :: Monad m => ParserD.Parser a m b -> ParserK a m b
613−fromParserSingular (ParserD.Parser step initial extract) =
614− MkParser $ parseDToKSingular step initial extract
611+{-# INLINE_LATE adapt #-}
612+adapt :: Monad m => ParserD.Parser a m b -> ParserK a m b
613+adapt (ParserD.Parser step initial extract) =
614+ MkParser $ adaptWith step initial extract
615615
616616--------------------------------------------------------------------------------
617617-- Chunked Generic
618618--------------------------------------------------------------------------------
619619
620−{-# INLINE parseDToKGeneric #-}
621−parseDToKGeneric
620+{-# INLINE adaptCGWith #-}
621+adaptCGWith
622622 :: forall m a s b r. (Monad m)
623623 => (s -> a -> m (ParserD.Step s b))
624624 -> m (ParserD.Initial s b)
@@ -628,7 +628,7 @@ parseDToKGeneric
628628 -> Int
629629 -> Input (GenArr.Array a)
630630 -> m (Step (GenArr.Array a) m r)
631−parseDToKGeneric pstep initial extract cont !offset0 !usedCount !input = do
631+adaptCGWith pstep initial extract cont !offset0 !usedCount !input = do
632632 res <- initial
633633 case res of
634634 ParserD.IPartial pst -> do
@@ -728,19 +728,19 @@ parseDToKGeneric pstep initial extract cont !offset0 !usedCount !input = do
728728 -- XXX It is called only when there is no input arr. So using 0
729729 -- as the position is correct?
730730 cont (Failure 0 err) count None
731− ParserD.Partial _ _ -> error "Bug: parseDToKGeneric Partial unreachable"
731+ ParserD.Partial _ _ -> error "Bug: adaptCGWith Partial unreachable"
732732
733733 {-# INLINE parseCont #-}
734734 parseCont !cnt !pst (Chunk arr) = parseContChunk cnt 0 pst arr
735735 parseCont !cnt !pst None = parseContNothing cnt pst
736736
737−-- | Similar to "fromParser" but is not constrained.
737+-- | Similar to "adaptC" but is not constrained.
738738--
739−{-# INLINE_LATE fromParserGeneric #-}
740−fromParserGeneric ::
739+{-# INLINE_LATE adaptCG #-}
740+adaptCG ::
741741 Monad m => ParserD.Parser a m b -> ParserK (GenArr.Array a) m b
742−fromParserGeneric (ParserD.Parser step initial extract) =
743− MkParser $ parseDToKGeneric step initial extract
742+adaptCG (ParserD.Parser step initial extract) =
743+ MkParser $ adaptCGWith step initial extract
744744
745745{-
746746-------------------------------------------------------------------------------