diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-31 18:47:51 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-31 18:47:51 +0200 |
commit | b16e56a555b37c5d0c01074b6c6a0dbcbb100bfe (patch) | |
tree | 6fc975bcdf8b6c3050235ef1c5b15b75132fff74 /events/src/Events/Spec/Parse.hs | |
parent | 02338aa196e9f3ddd4b2f8c35c5d04c64a813cec (diff) | |
download | events-b16e56a555b37c5d0c01074b6c6a0dbcbb100bfe.tar events-b16e56a555b37c5d0c01074b6c6a0dbcbb100bfe.tar.gz events-b16e56a555b37c5d0c01074b6c6a0dbcbb100bfe.tar.bz2 events-b16e56a555b37c5d0c01074b6c6a0dbcbb100bfe.tar.xz events-b16e56a555b37c5d0c01074b6c6a0dbcbb100bfe.zip |
framework for parsing Specs
Diffstat (limited to 'events/src/Events/Spec/Parse.hs')
-rw-r--r-- | events/src/Events/Spec/Parse.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/events/src/Events/Spec/Parse.hs b/events/src/Events/Spec/Parse.hs new file mode 100644 index 0000000..912a308 --- /dev/null +++ b/events/src/Events/Spec/Parse.hs | |||
@@ -0,0 +1,24 @@ | |||
1 | {-# LANGUAGE GADTs, DataKinds, OverloadedStrings #-} | ||
2 | |||
3 | module Events.Spec.Parse | ||
4 | ( parse | ||
5 | , Position(..), ParseError(..) | ||
6 | ) where | ||
7 | |||
8 | import Data.Conduit.Attoparsec | ||
9 | import Data.Conduit | ||
10 | |||
11 | import Data.Attoparsec.Text hiding (parse) | ||
12 | |||
13 | import Data.Text (Text) | ||
14 | import qualified Data.Text as T | ||
15 | |||
16 | import Events.Spec.Types | ||
17 | |||
18 | import Control.Monad.Catch (MonadThrow) | ||
19 | |||
20 | parse :: MonadThrow m => Consumer Text m (Spec m) | ||
21 | parse = sinkParser $ (tokenize >>= pSpec) <* endOfInput | ||
22 | |||
23 | pSpec :: Monad m => Parser (Spec m) | ||
24 | pSpec = mzero | ||