on master help sign in
Fix build with "dev" flag on
d55d68aHarendra Kumar
core/src/Streamly/Internal/Data/Array/Type.hs+14−2
@@ -315,11 +315,23 @@ fromStreamD str = unsafeFreeze <$> MA.fromStreamD str
315-------------------------------------------------------------------------------
315-------------------------------------------------------------------------------
316
316
317{-# INLINE clone #-}
317{-# INLINE clone #-}
318+clone ::
319+ ( MonadIO m
320+#ifdef DEVBUILD
321+ , Unbox a
322+#endif
323+ )
318−clone :: MonadIO m => Array a -> m (Array a)
324+ => Array a -> m (Array a)
319clone = fmap unsafeFreeze . MA.clone . unsafeThaw
325clone = fmap unsafeFreeze . MA.clone . unsafeThaw
320
326
321{-# INLINE pinnedClone #-}
327{-# INLINE pinnedClone #-}
328+pinnedClone ::
329+ ( MonadIO m
330+#ifdef DEVBUILD
331+ , Unbox a
332+#endif
333+ )
322−pinnedClone :: MonadIO m => Array a -> m (Array a)
334+ => Array a -> m (Array a)
323pinnedClone = fmap unsafeFreeze . MA.pinnedClone . unsafeThaw
335pinnedClone = fmap unsafeFreeze . MA.pinnedClone . unsafeThaw
324
336
325-------------------------------------------------------------------------------
337-------------------------------------------------------------------------------
core/src/Streamly/Internal/Data/MutArray/Type.hs+21−3
@@ -2098,7 +2098,13 @@ fromListRev xs = fromListRevN (Prelude.length xs) xs
2098-------------------------------------------------------------------------------
2098-------------------------------------------------------------------------------
2099
2099
2100{-# INLINE cloneAs #-}
2100{-# INLINE cloneAs #-}
2101+cloneAs ::
2102+ ( MonadIO m
2103+#ifdef DEVBUILD
2104+ , Unbox a
2105+#endif
2106+ )
2101−cloneAs :: MonadIO m => PinnedState -> MutArray a -> m (MutArray a)
2107+ => PinnedState -> MutArray a -> m (MutArray a)
2102cloneAs ps src =
2108cloneAs ps src =
2103 liftIO $ do
2109 liftIO $ do
2104 let startSrc = arrStart src
2110 let startSrc = arrStart src
@@ -2108,11 +2114,23 @@ cloneAs ps src =
2108 return $ MutArray newArrContents 0 srcLen srcLen
2114 return $ MutArray newArrContents 0 srcLen srcLen
2109
2115
2110{-# INLINE clone #-}
2116{-# INLINE clone #-}
2117+clone ::
2118+ ( MonadIO m
2119+#ifdef DEVBUILD
2120+ , Unbox a
2121+#endif
2122+ )
2111−clone :: MonadIO m => MutArray a -> m (MutArray a)
2123+ => MutArray a -> m (MutArray a)
2112clone = cloneAs Unpinned
2124clone = cloneAs Unpinned
2113
2125
2114{-# INLINE pinnedClone #-}
2126{-# INLINE pinnedClone #-}
2127+pinnedClone ::
2128+ ( MonadIO m
2129+#ifdef DEVBUILD
2130+ , Unbox a
2131+#endif
2132+ )
2115−pinnedClone :: MonadIO m => MutArray a -> m (MutArray a)
2133+ => MutArray a -> m (MutArray a)
2116pinnedClone = cloneAs Pinned
2134pinnedClone = cloneAs Pinned
2117
2135
2118-------------------------------------------------------------------------------
2136-------------------------------------------------------------------------------
core/src/Streamly/Internal/Data/Serialize/Type.hs+5−1
@@ -271,7 +271,11 @@ instance forall a. Serialize a => Serialize [a] where
271 pokeList (acc + 1) o1 xs
271 pokeList (acc + 1) o1 xs
272 pokeList 0 off1 val
272 pokeList 0 off1 val
273
273
274+instance
275+#ifdef DEVBUILD
276+ Unbox a =>
277+#endif
274−instance Serialize (Array a) where
278+ Serialize (Array a) where
275 {-# INLINE addSizeTo #-}
279 {-# INLINE addSizeTo #-}
276 addSizeTo i (Array {..}) = i + (arrEnd - arrStart) + 8
280 addSizeTo i (Array {..}) = i + (arrEnd - arrStart) + 8
277
281
core/streamly-core.cabal+3−2
@@ -444,9 +444,10 @@ library
444 , Streamly.Internal.Data.Time.Clock.Type
444 , Streamly.Internal.Data.Time.Clock.Type
445
445
446 if flag(dev)
446 if flag(dev)
447− other-modules:
447+ exposed-modules:
448 Streamly.Internal.Data.StreamK.Alt
448 Streamly.Internal.Data.StreamK.Alt
449+ -- XXX Compilation needs to be fixed
449− , Streamly.Internal.Data.List
450+ -- , Streamly.Internal.Data.List
450
451
451 build-depends:
452 build-depends:
452 -- streamly-base
453 -- 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
106-- of elements use an 'Array' from either "Streamly.Data.Array.Generic" or "Streamly.Data.Array.Foreign".
106-- of elements use an 'Array' from either "Streamly.Data.Array.Generic" or "Streamly.Data.Array.Foreign".
107{-# INLINE_NORMAL writeN #-}
107{-# INLINE_NORMAL writeN #-}
108writeN :: MonadIO m => Int -> Fold m a (SmallArray a)
108writeN :: 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
110
110
111 where
111 where
112
112
src/Streamly/Internal/FileSystem/FD.hs+2−3
@@ -120,7 +120,6 @@ import Control.Monad.IO.Class (MonadIO(..))
120import Data.Word (Word8)
120import Data.Word (Word8)
121-- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
121-- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
122import Foreign.Ptr (castPtr)
122import Foreign.Ptr (castPtr)
123−import Streamly.Internal.Data.Unbox (Unbox)
124-- import System.IO (Handle, hGetBufSome, hPutBuf)
123-- import System.IO (Handle, hGetBufSome, hPutBuf)
125import System.IO (IOMode)
124import System.IO (IOMode)
126import Prelude hiding (read)
125import Prelude hiding (read)
@@ -128,7 +127,7 @@ import Prelude hiding (read)
128import qualified GHC.IO.FD as FD
127import qualified GHC.IO.FD as FD
129import qualified GHC.IO.Device as RawIO
128import qualified GHC.IO.Device as RawIO
130
129
131−import Streamly.Data.Array (Array)
130+import Streamly.Data.Array (Array, Unbox)
132import Streamly.Data.Stream (Stream)
131import Streamly.Data.Stream (Stream)
133
132
134import Streamly.Internal.Data.Array (byteLength, unsafeFreeze, asPtrUnsafe)
133import Streamly.Internal.Data.Array (byteLength, unsafeFreeze, asPtrUnsafe)
@@ -149,7 +148,7 @@ import qualified Streamly.Data.Array as A
149import qualified Streamly.Data.Fold as FL
148import qualified Streamly.Data.Fold as FL
150import qualified Streamly.Internal.Data.MutArray as MArray
149import qualified Streamly.Internal.Data.MutArray as MArray
151 (MutArray(..), asPtrUnsafe, pinnedNewBytes)
150 (MutArray(..), asPtrUnsafe, pinnedNewBytes)
152−import qualified Streamly.Internal.Data.Stream.Chunked as AS
151+import qualified Streamly.Internal.Data.Array.Stream as AS
153import qualified Streamly.Internal.Data.Stream as S
152import qualified Streamly.Internal.Data.Stream as S
154import qualified Streamly.Internal.Data.Stream as D
153import qualified Streamly.Internal.Data.Stream as D
155 (Stream(..), Step(..))
154 (Stream(..), Step(..))
streamly.cabal+2−2
@@ -424,9 +424,9 @@ library
424 , Streamly.Internal.FileSystem.FD
424 , Streamly.Internal.FileSystem.FD
425
425
426 if flag(dev)
426 if flag(dev)
427− other-modules: Streamly.Data.SmallArray
427+ exposed-modules: Streamly.Data.SmallArray
428 , Streamly.Internal.Data.SmallArray
428 , Streamly.Internal.Data.SmallArray
429− , Streamly.Internal.Data.SmallArray.Type
429+ other-modules: Streamly.Internal.Data.SmallArray.Type
430
430
431 if os(windows)
431 if os(windows)
432 exposed-modules: Streamly.Internal.FileSystem.Event.Windows
432 exposed-modules: Streamly.Internal.FileSystem.Event.Windows
test/Streamly/Test/Prelude/Serial.hs+2−2
@@ -478,7 +478,7 @@ testTakeInterval :: IO Bool
478testTakeInterval = do
478testTakeInterval = do
479 r <-
479 r <-
480 S.fold (FL.tee FL.head FL.last)
480 S.fold (FL.tee FL.head FL.last)
481− $ S.takeInterval (toRelTime64 takeDropTime)
481+ $ S.takeInterval (fromIntegral takeDropTime * 10**(-9))
482 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
482 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
483 checkTakeDropTime r
483 checkTakeDropTime r
484
484
@@ -487,7 +487,7 @@ testDropInterval = do
487 t0 <- getTime Monotonic
487 t0 <- getTime Monotonic
488 mt1 <-
488 mt1 <-
489 S.fold FL.head
489 S.fold FL.head
490− $ S.dropInterval (toRelTime64 takeDropTime)
490+ $ S.dropInterval (fromIntegral takeDropTime * 10**(-9))
491 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
491 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
492 checkTakeDropTime (Just t0, mt1)
492 checkTakeDropTime (Just t0, mt1)
493#endif
493#endif
test/streamly-tests.cabal+8−7
@@ -216,13 +216,14 @@ common always-optimized
216-- Test suites in sorted order
216-- Test suites in sorted order
217-------------------------------------------------------------------------------
217-------------------------------------------------------------------------------
218
218
219+-- The Streamly.Data.List needs to be fixed to enable this
219−test-suite Data.List
220+-- test-suite Data.List
220− import: test-options
221+-- import: test-options
221− type: exitcode-stdio-1.0
222+-- type: exitcode-stdio-1.0
222− main-is: Streamly/Test/Data/List.hs
223+-- main-is: Streamly/Test/Data/List.hs
223− cpp-options: -DUSE_STREAMLY_LIST
224+-- cpp-options: -DUSE_STREAMLY_LIST
224− if !flag(dev)
225+-- if !flag(dev)
225− buildable: False
226+-- buildable: False
226
227
227test-suite Data.List.Base
228test-suite Data.List.Base
228 import: test-options
229 import: test-options