on c4794aa help sign in
53 lines 1.4 kB history raw
1-- |
2-- Module : Streamly.Data.ParserK
3-- Copyright : (c) 2023 Composewell Technologies
4-- License : BSD-3-Clause
5-- Maintainer : streamly@composewell.com
6-- Stability : pre-release
7-- Portability : GHC
8--
9-- Parsers using Continuation Passing Style (CPS). See notes in
10-- "Streamly.Data.Parser" module to know when to use this module.
11--
12-- To run a 'ParserK' use 'Streamly.Data.StreamK.parseChunks'.
13--
14module Streamly.Data.ParserK
15 (
16 -- * Parser Type
17 ParserK
19 -- * Parsers
20 -- ** Conversions
21 , adaptC
22 -- , toParser
24 -- ** Without Input
25 , fromPure
26 , fromEffect
27 , die
29 -- * Deprecated
30 , fromFold
31 , fromParser
32 )
34where
36import Control.Monad.IO.Class (MonadIO)
37import Streamly.Internal.Data.Fold (Fold)
38import Streamly.Internal.Data.Unbox (Unbox)
39import Streamly.Internal.Data.Array (Array)
40import qualified Streamly.Internal.Data.Parser as ParserD
42import Streamly.Internal.Data.Parser.ParserK.Type
44{-# DEPRECATED fromFold "Please use \"ParserK.adaptC . Parser.fromFold\" instead." #-}
45{-# INLINE fromFold #-}
46fromFold :: (MonadIO m, Unbox a) => Fold m a b -> ParserK (Array a) m b
47fromFold = adaptC . ParserD.fromFold
49{-# DEPRECATED fromParser "Please use \"adaptC\" instead." #-}
50{-# INLINE fromParser #-}
51fromParser ::
52 (MonadIO m, Unbox a) => ParserD.Parser a m b -> ParserK (Array a) m b
53fromParser = adaptC