From f0cc77e0a1cf99e2bc05c8e01e85edb702ffc7d7 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Wed, 28 Jun 2023 12:57:02 +0200 Subject: [PATCH] Support bytestring-0.11.3.0 This conditionally removes polyfills that clash with the new, actual upstream variants. --- .../src/Data/ByteString/Short/Extra.hs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/accelerate-llvm/src/Data/ByteString/Short/Extra.hs b/accelerate-llvm/src/Data/ByteString/Short/Extra.hs index 4f08e117e..87831df08 100644 --- a/accelerate-llvm/src/Data/ByteString/Short/Extra.hs +++ b/accelerate-llvm/src/Data/ByteString/Short/Extra.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE TemplateHaskell #-} @@ -13,6 +14,22 @@ -- Portability : non-portable (GHC extensions) -- +-- - bytestring-0.11.2.0 adds a Lift instance for ShortByteString +-- - bytestring-0.11.3.0 implements take and takeWhile +-- hence from 0.11.3.0 on, this alias for liftTyped suffices. +#if MIN_VERSION_bytestring(0,11,3) + +module Data.ByteString.Short.Extra (liftSBS) where + +import Data.ByteString.Short ( ShortByteString ) +import Language.Haskell.TH.Extra ( CodeQ ) +import Language.Haskell.TH.Syntax ( liftTyped ) + +liftSBS :: ShortByteString -> CodeQ ShortByteString +liftSBS = liftTyped + +#else + module Data.ByteString.Short.Extra ( ShortByteString, @@ -116,4 +133,4 @@ copyByteArray :: BA -> Int -> MBA s -> Int -> Int -> ST s () copyByteArray (BA# src#) (I# src_off#) (MBA# dst#) (I# dst_off#) (I# len#) = ST $ \s -> case copyByteArray# src# src_off# dst# dst_off# len# s of s' -> (# s', () #) - +#endif