Commits

Bryan O'Sullivan committed 17efeed

Relax dependency on attoparsec

This allows us to work with the version of the Haskell Platform
that is current as of early 2014.

Comments (0)

Files changed (2)

Data/Aeson/Parser/Internal.hs

 
 commaSeparated :: Parser a -> Word8 -> Parser [a]
 commaSeparated item endByte = do
-  w <- A.peekWord8'
+  w <- peekWord8'
   if w == endByte
     then A.anyWord8 >> return []
     else loop
 -- 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_
 -- | 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_
 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
       Data.Aeson.Types.Generic
 
   build-depends:
-    attoparsec >= 0.11.1.0,
+    attoparsec >= 0.10.2.1,
     base == 4.*,
     containers,
     deepseq,