Skip to content
Browse files

Relax dependency on attoparsec

This allows us to work with the version of the Haskell Platform
that is current as of early 2014.
  • Loading branch information...
1 parent e94d20d commit 473757c61a076d1c403126d4275f500c7f139f78 @bos committed Feb 3, 2014
Showing with 11 additions and 4 deletions.
  1. +10 −3 Data/Aeson/Parser/Internal.hs
  2. +1 −1 aeson.cabal
View
13 Data/Aeson/Parser/Internal.hs
@@ -133,7 +133,7 @@ array_' = {-# SCC "array_'" #-} do
commaSeparated :: Parser a -> Word8 -> Parser [a]
commaSeparated item endByte = do
- w <- A.peekWord8'
+ w <- peekWord8'
if w == endByte
then A.anyWord8 >> return []
else loop
@@ -164,7 +164,7 @@ arrayValues val = do
-- to preserve interoperability and security.
value :: Parser Value
value = do
- w <- A.peekWord8'
+ w <- peekWord8'
case w of
DOUBLE_QUOTE -> A.anyWord8 *> (String <$> jstring_)
OPEN_CURLY -> A.anyWord8 *> object_
@@ -179,7 +179,7 @@ value = do
-- | Strict version of 'value'. See also 'json''.
value' :: Parser Value
value' = do
- w <- A.peekWord8'
+ w <- peekWord8'
case w of
DOUBLE_QUOTE -> do
!s <- A.anyWord8 *> jstring_
@@ -349,3 +349,10 @@ toByteString :: Builder -> ByteString
toByteString = L.toStrict . toLazyByteString
{-# INLINE toByteString #-}
#endif
+
+peekWord8' :: A.Parser Word8
+#if MIN_VERSION_attoparsec(0,11,1)
+peekWord8' = A.peekWord8'
+#else
+peekWord8' = maybe (fail "not enough bytes") return =<< A.peekWord8
+#endif
View
2 aeson.cabal
@@ -112,7 +112,7 @@ library
Data.Aeson.Types.Generic
build-depends:
- attoparsec >= 0.11.1.0,
+ attoparsec >= 0.10.2.1,
base == 4.*,
containers,
deepseq,

0 comments on commit 473757c

Please sign in to comment.
Something went wrong with that request. Please try again.