@@ -33,6 +33,7 @@ module Streamly.Internal.Data.Array.Stream.Fold.Foreign
3333 -- * Construction
3434 , fromFold
3535 , fromParser
36+ , fromParserD
3637 , fromArrayFold
3738
3839 -- * Mapping
@@ -69,6 +70,8 @@ import qualified Streamly.Internal.Data.Array.Foreign as Array
6970import qualified Streamly.Internal.Data.Fold as Fold
7071import qualified Streamly.Internal.Data.Parser.ParserD as ParserD
7172import qualified Streamly.Internal.Data.Parser.ParserD.Type as ParserD
73+import qualified Streamly.Internal.Data.Parser.ParserK.Type as ParserK
74+import qualified Streamly.Internal.Data.Parser as Parser
7275
7376import Prelude hiding (concatMap, take)
7477
@@ -128,14 +131,14 @@ fromFold (Fold.Fold fstep finitial fextract) =
128131 Fold.Partial fs1 ->
129132 goArray SPEC next fs1
130133
131−-- | Convert an element 'Parser' into an array stream fold. If the parser fails
132−-- the fold would throw an exception.
134+-- | Convert an element 'ParserD.Parser' into an array stream fold. If the
135+-- parser fails the fold would throw an exception.
133136--
134137-- /Pre-release/
135−{-# INLINE fromParser #-}
136−fromParser :: forall m a b. (MonadIO m, Storable a) =>
138+{-# INLINE fromParserD #-}
139+fromParserD :: forall m a b. (MonadIO m, Storable a) =>
137140 ParserD.Parser m a b -> Fold m a b
138−fromParser (ParserD.Parser step1 initial1 extract1) =
141+fromParserD (ParserD.Parser step1 initial1 extract1) =
139142 Fold (ParserD.Parser step initial1 extract1)
140143
141144 where
@@ -170,6 +173,15 @@ fromParser (ParserD.Parser step1 initial1 extract1) =
170173 partial arrRem cur next elemSize Continue n fs1
171174 Error err -> return $ Error err
172175
176+-- | Convert an element 'Parser.Parser' into an array stream fold. If the parser
177+-- fails the fold would throw an exception.
178+--
179+-- /Pre-release/
180+{-# INLINE fromParser #-}
181+fromParser :: forall m a b. (MonadThrow m, MonadIO m, Storable a) =>
182+ Parser.Parser m a b -> Fold m a b
183+fromParser = fromParserD . ParserK.fromParserK
184+
173185-- | Adapt an array stream fold.
174186--
175187-- /Pre-release/