packages feed

attoparsec 0.8.1.1 → 0.8.2.0

raw patch · 5 files changed

+59/−10 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.Attoparsec: instance (Show r) => Show (Result r)
- Data.Attoparsec.Lazy: instance (Show r) => Show (Result r)
+ Data.Attoparsec: instance Show r => Show (Result r)
+ Data.Attoparsec.Char8: instance IsString (Parser ByteString)
+ Data.Attoparsec.Char8: isSpace_w8 :: Word8 -> Bool
+ Data.Attoparsec.Lazy: instance Show r => Show (Result r)
- Data.Attoparsec: parseTest :: (Show a) => Parser a -> ByteString -> IO ()
+ Data.Attoparsec: parseTest :: Show a => Parser a -> ByteString -> IO ()
- Data.Attoparsec: parseWith :: (Monad m) => (m ByteString) -> Parser a -> ByteString -> m (Result a)
+ Data.Attoparsec: parseWith :: Monad m => (m ByteString) -> Parser a -> ByteString -> m (Result a)
- Data.Attoparsec.Char8: decimal :: (Integral a) => Parser a
+ Data.Attoparsec.Char8: decimal :: Integral a => Parser a
- Data.Attoparsec.Char8: hexadecimal :: (Integral a) => Parser a
+ Data.Attoparsec.Char8: hexadecimal :: Integral a => Parser a
- Data.Attoparsec.Char8: parseTest :: (Show a) => Parser a -> ByteString -> IO ()
+ Data.Attoparsec.Char8: parseTest :: Show a => Parser a -> ByteString -> IO ()
- Data.Attoparsec.Char8: parseWith :: (Monad m) => (m ByteString) -> Parser a -> ByteString -> m (Result a)
+ Data.Attoparsec.Char8: parseWith :: Monad m => (m ByteString) -> Parser a -> ByteString -> m (Result a)
- Data.Attoparsec.Char8: signed :: (Num a) => Parser a -> Parser a
+ Data.Attoparsec.Char8: signed :: Num a => Parser a -> Parser a
- Data.Attoparsec.Combinator: choice :: (Alternative f) => [f a] -> f a
+ Data.Attoparsec.Combinator: choice :: Alternative f => [f a] -> f a
- Data.Attoparsec.Combinator: count :: (Monad m) => Int -> m a -> m [a]
+ Data.Attoparsec.Combinator: count :: Monad m => Int -> m a -> m [a]
- Data.Attoparsec.Combinator: eitherP :: (Alternative f) => f a -> f b -> f (Either a b)
+ Data.Attoparsec.Combinator: eitherP :: Alternative f => f a -> f b -> f (Either a b)
- Data.Attoparsec.Combinator: many :: (Alternative f) => f a -> f [a]
+ Data.Attoparsec.Combinator: many :: Alternative f => f a -> f [a]
- Data.Attoparsec.Combinator: many1 :: (Alternative f) => f a -> f [a]
+ Data.Attoparsec.Combinator: many1 :: Alternative f => f a -> f [a]
- Data.Attoparsec.Combinator: manyTill :: (Alternative f) => f a -> f b -> f [a]
+ Data.Attoparsec.Combinator: manyTill :: Alternative f => f a -> f b -> f [a]
- Data.Attoparsec.Combinator: option :: (Alternative f) => a -> f a -> f a
+ Data.Attoparsec.Combinator: option :: Alternative f => a -> f a -> f a
- Data.Attoparsec.Combinator: sepBy :: (Alternative f) => f a -> f s -> f [a]
+ Data.Attoparsec.Combinator: sepBy :: Alternative f => f a -> f s -> f [a]
- Data.Attoparsec.Combinator: sepBy1 :: (Alternative f) => f a -> f s -> f [a]
+ Data.Attoparsec.Combinator: sepBy1 :: Alternative f => f a -> f s -> f [a]
- Data.Attoparsec.Combinator: skipMany :: (Alternative f) => f a -> f ()
+ Data.Attoparsec.Combinator: skipMany :: Alternative f => f a -> f ()
- Data.Attoparsec.Combinator: skipMany1 :: (Alternative f) => f a -> f ()
+ Data.Attoparsec.Combinator: skipMany1 :: Alternative f => f a -> f ()
- Data.Attoparsec.Lazy: parseTest :: (Show a) => Parser a -> ByteString -> IO ()
+ Data.Attoparsec.Lazy: parseTest :: Show a => Parser a -> ByteString -> IO ()

Files

Data/Attoparsec/Char8.hs view
@@ -1,3 +1,6 @@+{-# LANGUAGE FlexibleInstances #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+ -- | -- Module      :  Data.Attoparsec.Char8 -- Copyright   :  Bryan O'Sullivan 2007-2010@@ -49,6 +52,7 @@     , isAlpha_iso8859_15     , isAlpha_ascii     , isSpace+    , isSpace_w8      -- *** Character classes     , inClass@@ -85,6 +89,7 @@ import Data.Attoparsec.FastSet (charClass, memberChar) import Data.Attoparsec.Internal (Parser, (<?>)) import Data.ByteString.Internal (c2w, w2c)+import Data.String (IsString(..)) import Data.Word (Word8) import Prelude hiding (takeWhile) import qualified Data.Attoparsec as A@@ -92,6 +97,9 @@ import qualified Data.ByteString as B8 import qualified Data.ByteString.Char8 as B +instance IsString (Parser B.ByteString) where+    fromString = I.string . B.pack+ -- $encodings -- -- This module is intended for parsing text that is@@ -188,17 +196,22 @@ anyChar = satisfy $ const True {-# INLINE anyChar #-} --- | Fast predicate for matching a space character.+-- | Fast predicate for matching ASCII space characters. -- -- /Note/: This predicate only gives correct answers for the ASCII -- encoding.  For instance, it does not recognise U+00A0 (non-breaking -- space) as a space character, even though it is a valid ISO-8859-15--- byte.+-- byte. For a Unicode-aware and only slightly slower predicate,+-- use 'Data.Char.isSpace' isSpace :: Char -> Bool-isSpace c = c `B.elem` spaces-    where spaces = B.pack " \n\r\t\v\f"-          {-# NOINLINE spaces #-}+isSpace c = (c == ' ') || ('\t' <= c && c <= '\r') {-# INLINE isSpace #-}++-- | Fast 'Word8' predicate for matching ASCII space characters.+isSpace_w8 :: Word8 -> Bool+isSpace_w8 w = (w == 32) || (9 <= w && w <= 13)+{-# INLINE isSpace_w8 #-}+  -- | Parse a space character. --
Data/Attoparsec/Internal.hs view
@@ -165,8 +165,14 @@ {-# INLINE apP #-}  instance Applicative Parser where-    pure  = returnP-    (<*>) = apP+    pure   = returnP+    (<*>)  = apP+    +    -- These definitions are equal to the defaults, but this+    -- way the optimizer doesn't have to work so hard to figure+    -- that out.+    (*>)   = (>>)+    x <* y = x >>= \a -> y >> return a  instance Alternative Parser where     empty = failDesc "empty"@@ -316,7 +322,7 @@  stringTransform :: (B.ByteString -> B.ByteString) -> B.ByteString                 -> Parser B.ByteString-stringTransform f s = takeWith (B.length s) ((==s) . f)+stringTransform f s = takeWith (B.length s) ((==f s) . f) {-# INLINE stringTransform #-}  -- | Skip past input for as long as the predicate returns 'True'.
+ README.markdown view
@@ -0,0 +1,29 @@+# Welcome to attoparsec++attoparsec is a fast Haskell parser combinator library, aimed+particularly at dealing efficiently with network protocols and+complicated text/binary file formats.++# Join in!++I'm happy to receive bug reports, fixes, documentation enhancements,+and other improvements.++Please report bugs via the+[bitbucket issue tracker](http://bitbucket.org/bos/attoparsec/issues).++Master [Mercurial repository](http://bitbucket.org/bos/attoparsec):++* `hg clone http://bitbucket.org/bos/attoparsec`++There's also a [git mirror](http://github.com/bos/attoparsec):++* `git clone git://github.com/bos/attoparsec.git`++(You can create and contribute changes using either Mercurial or git.)++Authors+-------++This library is written and maintained by Bryan O'Sullivan,+<bos@serpentine.com>.
attoparsec.cabal view
@@ -1,5 +1,5 @@ name:            attoparsec-version:         0.8.1.1+version:         0.8.2.0 license:         BSD3 license-file:    LICENSE category:        Text, Parsing@@ -17,6 +17,7 @@     efficiently with network protocols and complicated text/binary     file formats. extra-source-files:+    README.markdown     benchmarks/Makefile     benchmarks/Tiny.hs     benchmarks/med.txt.bz2
benchmarks/Tiny.hs view
@@ -14,7 +14,7 @@       A.Done _ xs -> print (length xs)       what        -> print what  where-  slow = A.many (A.many1 A.letter <|> A.many1 A.digit)+  slow = A.many (A.many1 A.letter_ascii <|> A.many1 A.digit)   fast = A.many (A.takeWhile1 isLetter <|> A.takeWhile1 isDigit)   isDigit c  = c >= '0' && c <= '9'   isLetter c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')