packages feed

attoparsec-conduit 1.0.1.1 → 1.0.1.2

raw patch · 2 files changed

+30/−16 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/Conduit/Attoparsec.hs view
@@ -26,11 +26,8 @@     ) where  import           Control.Exception          (Exception)-import           Control.Monad              (forever, unless)-import           Control.Monad.Trans.Class  (lift)+import           Control.Monad              (unless) import qualified Data.ByteString            as B-import qualified Data.ByteString.Char8      as B8-import           Data.Maybe                 (fromMaybe) import qualified Data.Text                  as T import qualified Data.Text.Internal         as TI import           Data.Typeable              (Typeable)@@ -40,7 +37,6 @@ import qualified Data.Attoparsec.Text import qualified Data.Attoparsec.Types      as A import           Data.Conduit-import qualified Data.Conduit.List          as C  -- | The context and message from a 'A.Fail' value. data ParseError = ParseError@@ -77,7 +73,7 @@     empty :: a     isNull :: a -> Bool     notEmpty :: [a] -> [a]-    getLinesCols :: a -> (Int, Int)+    getLinesCols :: a -> Position      -- | Return the beginning of the first input with the length of     -- the second input removed. Assumes the second string is shorter@@ -90,10 +86,10 @@     empty = B.empty     isNull = B.null     notEmpty = filter (not . B.null)-    getLinesCols = B.foldl' f (0, 0)+    getLinesCols = B.foldl' f (Position 0 0)       where-        f (!line, !col) ch | ch == 10 = (line + 1, 0)-                           | otherwise = (line, col + 1)+        f (Position l c) ch | ch == 10 = Position (l + 1) 0+                            | otherwise = Position l (c + 1)     stripFromEnd b1 b2 = B.take (B.length b1 - B.length b2) b1  instance AttoparsecInput T.Text where@@ -102,10 +98,10 @@     empty = T.empty     isNull = T.null     notEmpty = filter (not . T.null)-    getLinesCols = T.foldl' f (0, 0)+    getLinesCols = T.foldl' f (Position 0 0)       where-        f (!line, !col) ch | ch == '\n' = (line + 1, 0)-                           | otherwise = (line, col + 1)+        f (Position l c) ch | ch == '\n' = Position (l + 1) 0+                            | otherwise = Position l (c + 1)     stripFromEnd (TI.Text arr1 off1 len1) (TI.Text _ _ len2) =         TI.textP arr1 off1 (len1 - len2) @@ -136,6 +132,14 @@                    (!pos', !res) <- sinkParserPosErr pos parser                    yield (PositionRange pos pos', res)                    conduit pos'+{-# SPECIALIZE conduitParser+                   :: MonadThrow m+                   => A.Parser T.Text b+                   -> Conduit T.Text m (PositionRange, b) #-}+{-# SPECIALIZE conduitParser+                   :: MonadThrow m+                   => A.Parser B.ByteString b+                   -> Conduit B.ByteString m (PositionRange, b) #-}   @@ -152,12 +156,20 @@       where         go x = do           leftover x-          res <- sinkParserPos pos parser-          case res of+          eres <- sinkParserPos pos parser+          case eres of             Left e -> yield $ Left e             Right (!pos', !res) -> do               yield $! Right (PositionRange pos pos', res)               conduit pos'+{-# SPECIALIZE conduitParserEither+                   :: Monad m+                   => A.Parser T.Text b+                   -> Conduit T.Text m (Either ParseError (PositionRange, b)) #-}+{-# SPECIALIZE conduitParserEither+                   :: Monad m+                   => A.Parser B.ByteString b+                   -> Conduit B.ByteString m (Either ParseError (PositionRange, b)) #-}   @@ -171,6 +183,7 @@     where       f (Left e) = monadThrow e       f (Right a) = return a+{-# INLINE sinkParserPosErr #-}   sinkParserPos@@ -214,6 +227,7 @@     addLinesCols x (Position lines cols) =         lines' `seq` cols' `seq` Position lines' cols'       where-        (dlines, dcols) = getLinesCols x+        Position dlines dcols = getLinesCols x         lines' = lines + dlines         cols' = (if dlines > 0 then 1 else cols) + dcols+{-# INLINE sinkParserPos #-}
attoparsec-conduit.cabal view
@@ -1,5 +1,5 @@ Name:                attoparsec-conduit-Version:             1.0.1.1+Version:             1.0.1.2 Synopsis:            Consume attoparsec parsers via conduit. Description:         Consume attoparsec parsers via conduit. License:             MIT