on 68b2d87 help sign in
44 lines 1.1 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 , fromFold
22 , fromParser
23 -- , toParser
25 -- ** Without Input
26 , fromPure
27 , fromEffect
28 , die
29 )
31where
33import Control.Monad.IO.Class (MonadIO)
34import Streamly.Internal.Data.Fold (Fold)
35import Streamly.Internal.Data.Unboxed (Unbox)
36import qualified Streamly.Internal.Data.Parser.ParserD as ParserD
38import Streamly.Internal.Data.Parser.ParserK.Type
40-- | Convert a 'Fold' to a 'ParserK'.
41--
42{-# INLINE fromFold #-}
43fromFold :: (MonadIO m, Unbox a) => Fold m a b -> ParserK a m b
44fromFold = fromParser . ParserD.fromFold