From 5cdc83e3ad655e84c4cc806e683104de8eda1564 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Tue, 5 Dec 2023 17:29:34 +0100 Subject: [PATCH 1/2] Fix warnings related to deprecated alias boudedPrim from the bytestring library --- Data/Double/Conversion/Internal/ByteStringBuilder.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Data/Double/Conversion/Internal/ByteStringBuilder.hs b/Data/Double/Conversion/Internal/ByteStringBuilder.hs index a05960f..60b7b5a 100644 --- a/Data/Double/Conversion/Internal/ByteStringBuilder.hs +++ b/Data/Double/Conversion/Internal/ByteStringBuilder.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies, TypeOperators #-} +{-# LANGUAGE CPP, TypeFamilies, TypeOperators #-} -- | -- Module : Data.Double.Conversion.ByteStringBuilder @@ -18,7 +18,11 @@ module Data.Double.Conversion.Internal.ByteStringBuilder import Control.Monad (when) +#if MIN_VERSION_bytestring(0,10,12) +import Data.ByteString.Builder.Prim.Internal (BoundedPrim, boundedPrim) +#else import Data.ByteString.Builder.Prim.Internal (BoundedPrim, boudedPrim) +#endif import Data.Double.Conversion.Internal.FFI (ForeignFloating) import Data.Word (Word8) @@ -29,7 +33,11 @@ convert :: (RealFloat a, RealFloat b , b ~ ForeignFloating a) => String -> CInt {-# SPECIALIZE convert :: String -> CInt -> (CDouble -> Ptr Word8 -> IO CInt) -> BoundedPrim Double #-} {-# SPECIALIZE convert :: String -> CInt -> (CFloat -> Ptr Word8 -> IO CInt) -> BoundedPrim Float #-} {-# INLINABLE convert #-} +#if MIN_VERSION_bytestring(0,10,12) +convert func len act = boundedPrim (fromIntegral len) $ \val ptr -> do +#else convert func len act = boudedPrim (fromIntegral len) $ \val ptr -> do +#endif size <- act (realToFrac val) ptr when (size == -1) . fail $ "Data.Double.Conversion.ByteString." ++ func ++ From 97f411dccd8ea146ae5ae0f3d7d3ae44fa34bbd6 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Tue, 5 Dec 2023 17:29:46 +0100 Subject: [PATCH 2/2] Fix warnings related to StarIsType --- Data/Double/Conversion/Internal/FFI.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Data/Double/Conversion/Internal/FFI.hs b/Data/Double/Conversion/Internal/FFI.hs index cf970bf..b80f9e7 100644 --- a/Data/Double/Conversion/Internal/FFI.hs +++ b/Data/Double/Conversion/Internal/FFI.hs @@ -47,7 +47,12 @@ import Foreign.C.Types (CDouble, CFloat, CInt) import Foreign.Ptr (Ptr) import GHC.Prim (MutableByteArray#) +#if __GLASGOW_HASKELL__ >= 906 +import Data.Kind (Type) +type family ForeignFloating h :: Type +#else type family ForeignFloating h :: * +#endif type instance ForeignFloating Double = CDouble type instance ForeignFloating Float = CFloat