on master help sign in
Fix build with "dev" flag on
commitd55d68ab0775ab4b722db230874ea48b4c4a109c authorHarendra Kumar <harendra@composewell.com> dateTue 28 Nov 2023, 06:00 (3 years ago) parente7992b4
9 files changed+58−23
core/src/Streamly/Internal/Data/Array/Type.hs+14−2 core/src/Streamly/Internal/Data/MutArray/Type.hs+21−3 core/src/Streamly/Internal/Data/Serialize/Type.hs+5−1 core/streamly-core.cabal+3−2 src/Streamly/Internal/Data/SmallArray.hs+1−1 src/Streamly/Internal/FileSystem/FD.hs+2−3 streamly.cabal+2−2 test/Streamly/Test/Prelude/Serial.hs+2−2 test/streamly-tests.cabal+8−7
core/src/Streamly/Internal/Data/Array/Type.hs+14−2
@@ -315,11 +315,23 @@ fromStreamD str = unsafeFreeze <$> MA.fromStreamD str
315315-------------------------------------------------------------------------------
316316
317317{-# INLINE clone #-}
318−clone :: MonadIO m => Array a -> m (Array a)
318+clone ::
319+ ( MonadIO m
320+#ifdef DEVBUILD
321+ , Unbox a
322+#endif
323+ )
324+ => Array a -> m (Array a)
319325clone = fmap unsafeFreeze . MA.clone . unsafeThaw
320326
321327{-# INLINE pinnedClone #-}
322−pinnedClone :: MonadIO m => Array a -> m (Array a)
328+pinnedClone ::
329+ ( MonadIO m
330+#ifdef DEVBUILD
331+ , Unbox a
332+#endif
333+ )
334+ => Array a -> m (Array a)
323335pinnedClone = fmap unsafeFreeze . MA.pinnedClone . unsafeThaw
324336
325337-------------------------------------------------------------------------------
core/src/Streamly/Internal/Data/MutArray/Type.hs+21−3
@@ -2098,7 +2098,13 @@ fromListRev xs = fromListRevN (Prelude.length xs) xs
20982098-------------------------------------------------------------------------------
20992099
21002100{-# INLINE cloneAs #-}
2101−cloneAs :: MonadIO m => PinnedState -> MutArray a -> m (MutArray a)
2101+cloneAs ::
2102+ ( MonadIO m
2103+#ifdef DEVBUILD
2104+ , Unbox a
2105+#endif
2106+ )
2107+ => PinnedState -> MutArray a -> m (MutArray a)
21022108cloneAs ps src =
21032109 liftIO $ do
21042110 let startSrc = arrStart src
@@ -2108,11 +2114,23 @@ cloneAs ps src =
21082114 return $ MutArray newArrContents 0 srcLen srcLen
21092115
21102116{-# INLINE clone #-}
2111−clone :: MonadIO m => MutArray a -> m (MutArray a)
2117+clone ::
2118+ ( MonadIO m
2119+#ifdef DEVBUILD
2120+ , Unbox a
2121+#endif
2122+ )
2123+ => MutArray a -> m (MutArray a)
21122124clone = cloneAs Unpinned
21132125
21142126{-# INLINE pinnedClone #-}
2115−pinnedClone :: MonadIO m => MutArray a -> m (MutArray a)
2127+pinnedClone ::
2128+ ( MonadIO m
2129+#ifdef DEVBUILD
2130+ , Unbox a
2131+#endif
2132+ )
2133+ => MutArray a -> m (MutArray a)
21162134pinnedClone = cloneAs Pinned
21172135
21182136-------------------------------------------------------------------------------
core/src/Streamly/Internal/Data/Serialize/Type.hs+5−1
@@ -271,7 +271,11 @@ instance forall a. Serialize a => Serialize [a] where
271271 pokeList (acc + 1) o1 xs
272272 pokeList 0 off1 val
273273
274−instance Serialize (Array a) where
274+instance
275+#ifdef DEVBUILD
276+ Unbox a =>
277+#endif
278+ Serialize (Array a) where
275279 {-# INLINE addSizeTo #-}
276280 addSizeTo i (Array {..}) = i + (arrEnd - arrStart) + 8
277281
core/streamly-core.cabal+3−2
@@ -444,9 +444,10 @@ library
444444 , Streamly.Internal.Data.Time.Clock.Type
445445
446446 if flag(dev)
447− other-modules:
447+ exposed-modules:
448448 Streamly.Internal.Data.StreamK.Alt
449− , Streamly.Internal.Data.List
449+ -- XXX Compilation needs to be fixed
450+ -- , Streamly.Internal.Data.List
450451
451452 build-depends:
452453 -- streamly-base
src/Streamly/Internal/Data/SmallArray.hs+1−1
@@ -106,7 +106,7 @@ foldr f z arr = runIdentity $ D.foldr f z $ toStreamD arr
106106-- of elements use an 'Array' from either "Streamly.Data.Array.Generic" or "Streamly.Data.Array.Foreign".
107107{-# INLINE_NORMAL writeN #-}
108108writeN :: MonadIO m => Int -> Fold m a (SmallArray a)
109−writeN len = FL.Fold step initial extract
109+writeN len = FL.Fold step initial extract extract
110110
111111 where
112112
src/Streamly/Internal/FileSystem/FD.hs+2−3
@@ -120,7 +120,6 @@ import Control.Monad.IO.Class (MonadIO(..))
120120import Data.Word (Word8)
121121-- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
122122import Foreign.Ptr (castPtr)
123−import Streamly.Internal.Data.Unbox (Unbox)
124123-- import System.IO (Handle, hGetBufSome, hPutBuf)
125124import System.IO (IOMode)
126125import Prelude hiding (read)
@@ -128,7 +127,7 @@ import Prelude hiding (read)
128127import qualified GHC.IO.FD as FD
129128import qualified GHC.IO.Device as RawIO
130129
131−import Streamly.Data.Array (Array)
130+import Streamly.Data.Array (Array, Unbox)
132131import Streamly.Data.Stream (Stream)
133132
134133import Streamly.Internal.Data.Array (byteLength, unsafeFreeze, asPtrUnsafe)
@@ -149,7 +148,7 @@ import qualified Streamly.Data.Array as A
149148import qualified Streamly.Data.Fold as FL
150149import qualified Streamly.Internal.Data.MutArray as MArray
151150 (MutArray(..), asPtrUnsafe, pinnedNewBytes)
152−import qualified Streamly.Internal.Data.Stream.Chunked as AS
151+import qualified Streamly.Internal.Data.Array.Stream as AS
153152import qualified Streamly.Internal.Data.Stream as S
154153import qualified Streamly.Internal.Data.Stream as D
155154 (Stream(..), Step(..))
streamly.cabal+2−2
@@ -424,9 +424,9 @@ library
424424 , Streamly.Internal.FileSystem.FD
425425
426426 if flag(dev)
427− other-modules: Streamly.Data.SmallArray
427+ exposed-modules: Streamly.Data.SmallArray
428428 , Streamly.Internal.Data.SmallArray
429− , Streamly.Internal.Data.SmallArray.Type
429+ other-modules: Streamly.Internal.Data.SmallArray.Type
430430
431431 if os(windows)
432432 exposed-modules: Streamly.Internal.FileSystem.Event.Windows
test/Streamly/Test/Prelude/Serial.hs+2−2
@@ -478,7 +478,7 @@ testTakeInterval :: IO Bool
478478testTakeInterval = do
479479 r <-
480480 S.fold (FL.tee FL.head FL.last)
481− $ S.takeInterval (toRelTime64 takeDropTime)
481+ $ S.takeInterval (fromIntegral takeDropTime * 10**(-9))
482482 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
483483 checkTakeDropTime r
484484
@@ -487,7 +487,7 @@ testDropInterval = do
487487 t0 <- getTime Monotonic
488488 mt1 <-
489489 S.fold FL.head
490− $ S.dropInterval (toRelTime64 takeDropTime)
490+ $ S.dropInterval (fromIntegral takeDropTime * 10**(-9))
491491 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
492492 checkTakeDropTime (Just t0, mt1)
493493#endif
test/streamly-tests.cabal+8−7
@@ -216,13 +216,14 @@ common always-optimized
216216-- Test suites in sorted order
217217-------------------------------------------------------------------------------
218218
219−test-suite Data.List
220− import: test-options
221− type: exitcode-stdio-1.0
222− main-is: Streamly/Test/Data/List.hs
223− cpp-options: -DUSE_STREAMLY_LIST
224− if !flag(dev)
225− buildable: False
219+-- The Streamly.Data.List needs to be fixed to enable this
220+-- test-suite Data.List
221+-- import: test-options
222+-- type: exitcode-stdio-1.0
223+-- main-is: Streamly/Test/Data/List.hs
224+-- cpp-options: -DUSE_STREAMLY_LIST
225+-- if !flag(dev)
226+-- buildable: False
226227
227228test-suite Data.List.Base
228229 import: test-options