bytestringreadp 0.1 → 0.2
raw patch · 3 files changed
+33/−27 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- LICENSE +2/−1
- bytestringreadp.cabal +18/−8
- src/Text/ParserCombinators/ReadP/ByteString.hs +13/−18
LICENSE view
@@ -1,6 +1,7 @@ The Glasgow Haskell Compiler License -Copyright 2002, The University Court of the University of Glasgow. +Copyright 2002, The University Court of the University of Glasgow.+Copyright 2007, Gracjan Polak All rights reserved. Redistribution and use in source and binary forms, with or without
bytestringreadp.cabal view
@@ -1,7 +1,6 @@ Name: bytestringreadp-Version: 0.1+Version: 0.2 Stability: alpha-Exposed-modules: Text.ParserCombinators.ReadP.ByteString License: BSD3 License-File: LICENSE Copyright: 2007-2007, Gracjan Polak@@ -18,9 +17,20 @@ Adapted to use Data.ByteString by Gracjan Polak. Designed as a drop-in replacement for Text.ParserCombinators.ReadP. Category: Text-Build-depends: base, bytestring-Extensions: CPP-Hs-source-dirs: src-Ghc-options: -O2-CC-options: -O2-Include-dirs: src+Cabal-Version: >=1.2+Build-type: Simple+Flag splitBase+ description: Choose the new smaller, split-up base package.++Library+ Exposed-modules: Text.ParserCombinators.ReadP.ByteString+ if flag(splitBase)+ build-depends: base >= 3, bytestring+ else+ build-depends: base < 3+ Ghc-options: -DBYTESTRING_BASE_ONLY+ Extensions: CPP+ Hs-source-dirs: src+ Ghc-options: -O2+ CC-options: -O2+ Include-dirs: src
src/Text/ParserCombinators/ReadP/ByteString.hs view
@@ -1,4 +1,5 @@-{-# OPTIONS_GHC -fglasgow-exts -cpp -fno-implicit-prelude #-} +{-# OPTIONS_GHC -cpp -fno-implicit-prelude -fglasgow-exts #-} +-- -XTypeOperators -XExistentialQuantification -XPolymorphicComponents ----------------------------------------------------------------------------- -- | -- Module : Text.ParserCombinators.ReadP.ByteString @@ -69,26 +70,20 @@ ) where -import Control.Monad( MonadPlus(..), sequence, liftM2, Monad, (>>), (>>=), return, fail, sequence_ ) -import Prelude ((+),fromInteger,(++),Int,Bool(..),(==),error,seq,id,fromIntegral, (-)) - -import Data.Word -import Data.ByteString hiding (count,foldl') +import Control.Monad ( MonadPlus(..), liftM2, Monad, (>>), (>>=), + return, fail, Functor, fmap, replicateM ) +import Prelude ( (+), (-), (++), Int, Bool(..), (==), error, + fromInteger, (.), (>=), compare, Ordering(..) ) +import Data.Word (Word8) +import Data.ByteString (ByteString,length,take,takeWhile,null) -#ifndef __HADDOCK__ -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__<608 -import Data.ByteString.Base +#ifdef BYTESTRING_BASE_ONLY +import Data.ByteString.Base (unsafeDrop,unsafeHead,isSpaceWord8) #else -import Data.ByteString.Unsafe -#endif +import Data.ByteString.Unsafe (unsafeDrop,unsafeHead) +import Data.ByteString.Internal (isSpaceWord8) #endif -import Control.Monad ( replicateM ) -import Data.List (foldl') -import GHC.Base -import GHC.Exts -import Data.Char ( isSpace ) - infixr 5 +++, <++ ------------------------------------------------------------------------ @@ -312,7 +307,7 @@ skipSpaces :: ReadP () -- ^ Skips all whitespace. -skipSpaces = munch (isSpace . chr . fromIntegral) >> return () +skipSpaces = munch isSpaceWord8 >> return () count :: Int -> ReadP a -> ReadP [a] -- ^ @count n p@ parses @n@ occurrences of @p@ in sequence. A list of