on 89b95bd help sign in
112 lines 2.1 kB history raw
1-- |
2-- Module : Streamly.Data.Parser
3-- Copyright : (c) 2020 Composewell Technologies
4-- License : BSD-3-Clause
5-- Maintainer : streamly@composewell.com
6-- Stability : pre-release
7-- Portability : GHC
8--
9-- Fast backtracking parsers with stream fusion and native streaming
10-- capability. Parsers are just more powerful folds, folds and parsers can be
11-- interconverted.
12--
13-- Note that these parsers do not report the error context (e.g. line number or
14-- column). This may be supported in future.
15--
16-- mtl instances are not provided. If the 'Parser' type is the top most layer
17-- (which should be the case almost always) you can just use 'fromEffect' to
18-- execute the lower layer monad effects.
19--
20module Streamly.Data.Parser
21 (
22 -- * Parser Type
23 Parser
25 -- -- * Downgrade to Fold
26 -- , toFold
28 -- * Parsers
29 -- ** From Folds
30 , fromFold
32 -- ** Without Input
33 -- , fromFoldMaybe
34 , fromPure
35 , fromEffect
36 , die
37 -- , dieM
38 , peek
39 , eof
41 -- ** Element parsers
43 -- All of these can be expressed in terms of either
44 , one
45 -- , oneEq
46 -- , oneNotEq
47 , oneOf
48 , noneOf
49 , satisfy
50 -- , maybe
51 -- , either
53 -- ** Sequences
54 , streamEqBy
55 , listEqBy
56 , listEq
58 -- * Combinators
59 -- Mapping on output
60 -- , rmapM
62 -- ** Mapping on input
63 , lmap
64 , lmapM
66 -- * Map on output
67 , rmapM
69 -- ** Filtering
70 , filter
72 -- ** Look Ahead
73 , lookAhead
75 -- ** Tokenize by length
76 -- , takeBetween
77 , takeEQ
78 -- , takeGE
79 -- , takeP
81 -- ** Tokenize by predicate
82 -- , takeWhileP
83 , takeWhile
84 , takeWhile1
85 , dropWhile
86 -- , takeEndBy
87 -- , takeEndByEsc
88 -- , takeStartBy
89 , wordBy
91 -- ** Grouping
92 , groupBy
93 -- , groupByRolling
94 -- , groupByRollingEither
96 -- ** Framing
97 , wordFramedBy
98 , wordQuotedBy
100 -- ** Splitting
101 , many
102 , some
103 , manyTill
105 -- ** De-interleaving
106 , deintercalate
107 )
109where
111import Streamly.Internal.Data.Parser
112import Prelude hiding (dropWhile, takeWhile, filter)