on master help sign in
Fix building against bytestring 0.9.*

This patch was from Michael Snoyman.

commit22d4cbb6d1da9da344f92b2a6e3b29be4fc7603d authorAntoine Latter <aslatter@gmail.com> dateWed 23 Oct 2013, 01:45 (13 years ago) parent637be18
1 file changed+14−2
Data/UUID/Internal.hs+14−2
Data/UUID/Internal.hs+14−2
@@ -391,12 +391,24 @@ fromASCIIBytes bs = do
391391
392392-- | Similar to `toASCIIBytes` except we produce a lazy `BL.ByteString`.
393393toLazyASCIIBytes :: UUID -> BL.ByteString
394−toLazyASCIIBytes = BL.fromStrict . toASCIIBytes
394+toLazyASCIIBytes =
395+#if MIN_VERSION_bytestring(0,10,0)
396+ BL.fromStrict
397+#else
398+ BL.fromChunks . return
399+#endif
400+ . toASCIIBytes
395401
396402-- | Similar to `fromASCIIBytes` except parses from a lazy `BL.ByteString`.
397403fromLazyASCIIBytes :: BL.ByteString -> Maybe UUID
398404fromLazyASCIIBytes bs =
399− if BL.length bs == 36 then fromASCIIBytes (BL.toStrict bs) else Nothing
405+ if BL.length bs == 36 then fromASCIIBytes (
406+#if MIN_VERSION_bytestring(0,10,0)
407+ BL.toStrict bs
408+#else
409+ B.concat $ BL.toChunks bs
410+#endif
411+ ) else Nothing
400412
401413--
402414-- Class Instances