Skip to content

Commit 0731400

Browse files
authored
Merge pull request #806 from phadej/bytestring-0.11
Support bytestring-0.11
2 parents 9985e30 + 6814db7 commit 0731400

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

aeson.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ library
100100
-- GHC bundled libs
101101
build-depends:
102102
base >= 4.7.0.0 && < 5,
103-
bytestring >= 0.10.4.0 && < 0.11,
103+
bytestring >= 0.10.4.0 && < 0.12,
104104
containers >= 0.5.5.1 && < 0.7,
105105
deepseq >= 1.3.0.0 && < 1.5,
106106
ghc-prim >= 0.2 && < 0.8,

cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ packages: .
33
packages: attoparsec-iso8601
44
packages: examples
55
tests: true
6+
-- constraints: aeson +cffi

ffi/Data/Aeson/Parser/UnescapeFFI.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE ForeignFunctionInterface #-}
23
{-# LANGUAGE MagicHash #-}
34
{-# LANGUAGE UnliftedFFITypes #-}
@@ -29,7 +30,12 @@ foreign import ccall unsafe "_js_decode_string" c_js_decode
2930
-> Ptr Word8 -> Ptr Word8 -> IO CInt
3031

3132
unescapeText' :: ByteString -> Text
33+
#if MIN_VERSION_bytestring(0,11,0)
34+
unescapeText' (BS fp len) = runText $ \done -> do
35+
let off = 0
36+
#else
3237
unescapeText' (PS fp off len) = runText $ \done -> do
38+
#endif
3339
let go dest = withForeignPtr fp $ \ptr ->
3440
with (0::CSize) $ \destOffPtr -> do
3541
let end = ptr `plusPtr` (off + len)

0 commit comments

Comments
 (0)