packages feed

delimited-text 0.2.1 → 0.3.0

raw patch · 3 files changed

+11/−13 lines, 3 filesdep ~attoparsecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: attoparsec

API changes (from Hackage documentation)

Files

Text/Delimited/ByteString/Lazy.hs view
@@ -2,9 +2,9 @@     encode, decode, interact ) where -import           Data.ByteString.Lazy (ByteString, toChunks)-import qualified Data.ByteString as BS+import           Data.ByteString.Lazy (ByteString) import qualified Data.Attoparsec.Char8 as P+import qualified Data.Attoparsec.Lazy as PL import           Prelude hiding (interact) import           Text.Delimited.Types import           Text.Delimited.Put (putContent, runPut)@@ -14,10 +14,6 @@ encode :: Char -> Content -> ByteString encode delim = runPut . putContent delim --- | Construct a strict ByteString from a lazy one.-fromLazy :: ByteString -> BS.ByteString-fromLazy = BS.concat . toChunks- -- | Construct a parser from 'a' terminated by 'b'. endBy :: P.Parser a -> P.Parser b -> P.Parser a a `endBy` b = do@@ -30,8 +26,8 @@ parser delims = line `P.manyTill` P.endOfInput     where         line  = (field `P.sepBy` sep) `endBy` eol-        field = fromLazy `fmap` P.takeWhile (P.notInClass (delims ++ nls))-        sep   =              P.satisfy $ P.inClass delims+        field = P.takeWhile (P.notInClass (delims ++ nls))+        sep   = P.satisfy (P.inClass delims)         eol   = P.skipMany1 (P.satisfy $ P.inClass nls)         nls   = "\n\r" @@ -40,7 +36,7 @@ -- no way of escaping delimiters, so record fields may not contain any of the -- characters in 'delims'. decode :: [Char] -> ByteString -> Result Content-decode delims = snd . P.parse (parser delims)+decode delims = PL.eitherResult . PL.parse (parser delims)  -- | Decode a ByteString, apply a function to each 'Record' and encode the content. -- Delimiters may contain multiple characters but only the first is used for
Text/Delimited/Types.hs view
@@ -4,7 +4,6 @@ ) where  import Data.ByteString (ByteString)-import Data.Attoparsec.Char8 (ParseError)  -- | A delimited file is a series of variable length records. type Content = [Record]@@ -15,6 +14,9 @@  -- | A field is a strict ByteString. type Field = ByteString++-- | Error message type.+type ParseError = String  -- | Result type. type Result a = Either ParseError a
delimited-text.cabal view
@@ -1,11 +1,11 @@ Name:               delimited-text-Version:            0.2.1+Version:            0.3.0 Synopsis:           Parse character delimited textual data Description:        Parse character delimited textual data License:            BSD3 License-File:       LICENSE Category:           Data-Copyright:          Copyright (c) Stefan Kersten 2008-2010+Copyright:          Copyright (c) Stefan Kersten 2008-2011 Author:             Stefan Kersten <sk@xdv.org> Maintainer:         Stefan Kersten <sk@xdv.org> Stability:          provisional@@ -29,7 +29,7 @@   Build-Depends:    base >= 3 && < 5                   , binary >= 0.4                   , bytestring-                  , attoparsec >= 0.7 && < 0.8+                  , attoparsec >= 0.8                   , bytestring-show >= 0.2    Ghc-Options:      -W