packages feed

PArrows 0.1 → 0.1.1

raw patch · 4 files changed

+16/−9 lines, 4 filesdep +ghc-prim

Dependencies added: ghc-prim

Files

PArrows.cabal view
@@ -1,8 +1,9 @@ Name:            PArrows-Version:         0.1+Version:         0.1.1 License:         BSD3 License-File:    LICENSE Author:          Einar Karttunen <ekarttun@cs.helsinki.fi>+Maintainer:      none Stability:       Alpha Category:        Parsing Synopsis:        Arrow parser combinators similar to Parsec@@ -11,12 +12,13 @@                  .                  Currently PArrows is only tested with GHC, although making it work with Hugs should be easy. Homepage:        http://www.cs.helsinki.fi/u/ekarttun/PArrows/-Build-Depends:   base>3, containers, mtl-Build-Type:      Simple-Tested-With:     GHC==6.8.2 +Build-Depends:   base>3, containers, mtl, ghc-prim+Build-Type:      Simple+Tested-With:     GHC==6.10+cabal-version:   >= 1.2.3 Extensions:      FlexibleContexts, FunctionalDependencies, MagicHash, GADTs-Ghc-Options:     -O2 -Wall+Ghc-Options:     -Wall  Hs-Source-Dirs:  src Exposed-Modules: Text.ParserCombinators.PArrow,
src/Text/ParserCombinators/PArrow/Char.hs view
@@ -47,5 +47,5 @@  -- | Match a constant string. string :: String -> MD i String-string []  = pure (\_ -> "")-string str = pure (\_ -> ' ') >>> foldr1 (>>>) (map char str) >>> pure (\_ -> str)+string []  = arr (\_ -> "")+string str = arr (\_ -> ' ') >>> foldr1 (>>>) (map char str) >>> arr (\_ -> str)
src/Text/ParserCombinators/PArrow/Combinator.hs view
@@ -13,7 +13,7 @@  -- | Match one or more occurences of the given parser. many1 :: MD i o -> MD i [o]-many1 x = (x &&& MStar x) >>> pure (\(b,bs) -> (b:bs))+many1 x = (x &&& MStar x) >>> arr (\(b,bs) -> (b:bs))  -- | Match if the given parser does not match. notFollowedBy :: MD i o -> MD i o
src/Text/ParserCombinators/PArrow/MD.hs view
@@ -3,8 +3,10 @@ module Text.ParserCombinators.PArrow.MD (MD(..)) where  import Control.Arrow+import Control.Category import Data.List (intersperse) import GHC.Prim (unsafeCoerce#)+import Prelude hiding (id,(.)) import Text.ParserCombinators.PArrow.CharSet  data MD i o where@@ -35,9 +37,12 @@ force :: MD a b -> MD c d force = unsafeCoerce# +instance Category MD where+    b . a = a `MSeq` b+    id    = arr id+ instance Arrow MD where     arr f    = MPure "" f-    a >>> b  = a `MSeq` b     a *** b  = a `MParWire` b     a &&& b  = a `MJoin` b     first a  = a `MParWire` ("id" `MPure` id)