diff --git a/core/src/Streamly/Internal/Data/Array/Type.hs b/core/src/Streamly/Internal/Data/Array/Type.hs index e154858ca..e9dca094a 100644 --- a/core/src/Streamly/Internal/Data/Array/Type.hs +++ b/core/src/Streamly/Internal/Data/Array/Type.hs @@ -315,11 +315,23 @@ fromStreamD str = unsafeFreeze <$> MA.fromStreamD str ------------------------------------------------------------------------------- {-# INLINE clone #-} -clone :: MonadIO m => Array a -> m (Array a) +clone :: + ( MonadIO m +#ifdef DEVBUILD + , Unbox a +#endif + ) + => Array a -> m (Array a) clone = fmap unsafeFreeze . MA.clone . unsafeThaw {-# INLINE pinnedClone #-} -pinnedClone :: MonadIO m => Array a -> m (Array a) +pinnedClone :: + ( MonadIO m +#ifdef DEVBUILD + , Unbox a +#endif + ) + => Array a -> m (Array a) pinnedClone = fmap unsafeFreeze . MA.pinnedClone . unsafeThaw ------------------------------------------------------------------------------- diff --git a/core/src/Streamly/Internal/Data/MutArray/Type.hs b/core/src/Streamly/Internal/Data/MutArray/Type.hs index 2e1b26a99..e014a1837 100644 --- a/core/src/Streamly/Internal/Data/MutArray/Type.hs +++ b/core/src/Streamly/Internal/Data/MutArray/Type.hs @@ -2098,7 +2098,13 @@ fromListRev xs = fromListRevN (Prelude.length xs) xs ------------------------------------------------------------------------------- {-# INLINE cloneAs #-} -cloneAs :: MonadIO m => PinnedState -> MutArray a -> m (MutArray a) +cloneAs :: + ( MonadIO m +#ifdef DEVBUILD + , Unbox a +#endif + ) + => PinnedState -> MutArray a -> m (MutArray a) cloneAs ps src = liftIO $ do let startSrc = arrStart src @@ -2108,11 +2114,23 @@ cloneAs ps src = return $ MutArray newArrContents 0 srcLen srcLen {-# INLINE clone #-} -clone :: MonadIO m => MutArray a -> m (MutArray a) +clone :: + ( MonadIO m +#ifdef DEVBUILD + , Unbox a +#endif + ) + => MutArray a -> m (MutArray a) clone = cloneAs Unpinned {-# INLINE pinnedClone #-} -pinnedClone :: MonadIO m => MutArray a -> m (MutArray a) +pinnedClone :: + ( MonadIO m +#ifdef DEVBUILD + , Unbox a +#endif + ) + => MutArray a -> m (MutArray a) pinnedClone = cloneAs Pinned ------------------------------------------------------------------------------- diff --git a/core/src/Streamly/Internal/Data/Serialize/Type.hs b/core/src/Streamly/Internal/Data/Serialize/Type.hs index 695fdb48e..90c009cd7 100644 --- a/core/src/Streamly/Internal/Data/Serialize/Type.hs +++ b/core/src/Streamly/Internal/Data/Serialize/Type.hs @@ -271,7 +271,11 @@ instance forall a. Serialize a => Serialize [a] where pokeList (acc + 1) o1 xs pokeList 0 off1 val -instance Serialize (Array a) where +instance +#ifdef DEVBUILD + Unbox a => +#endif + Serialize (Array a) where {-# INLINE addSizeTo #-} addSizeTo i (Array {..}) = i + (arrEnd - arrStart) + 8 diff --git a/core/streamly-core.cabal b/core/streamly-core.cabal index 35e0eafec..ab861ebef 100644 --- a/core/streamly-core.cabal +++ b/core/streamly-core.cabal @@ -444,9 +444,10 @@ library , Streamly.Internal.Data.Time.Clock.Type if flag(dev) - other-modules: + exposed-modules: Streamly.Internal.Data.StreamK.Alt - , Streamly.Internal.Data.List + -- XXX Compilation needs to be fixed + -- , Streamly.Internal.Data.List build-depends: -- streamly-base diff --git a/src/Streamly/Internal/Data/SmallArray.hs b/src/Streamly/Internal/Data/SmallArray.hs index a1edc7c8b..c35186059 100644 --- a/src/Streamly/Internal/Data/SmallArray.hs +++ b/src/Streamly/Internal/Data/SmallArray.hs @@ -106,7 +106,7 @@ foldr f z arr = runIdentity $ D.foldr f z $ toStreamD arr -- of elements use an 'Array' from either "Streamly.Data.Array.Generic" or "Streamly.Data.Array.Foreign". {-# INLINE_NORMAL writeN #-} writeN :: MonadIO m => Int -> Fold m a (SmallArray a) -writeN len = FL.Fold step initial extract +writeN len = FL.Fold step initial extract extract where diff --git a/src/Streamly/Internal/FileSystem/FD.hs b/src/Streamly/Internal/FileSystem/FD.hs index 5b62b069d..05189feb0 100644 --- a/src/Streamly/Internal/FileSystem/FD.hs +++ b/src/Streamly/Internal/FileSystem/FD.hs @@ -120,7 +120,6 @@ import Control.Monad.IO.Class (MonadIO(..)) import Data.Word (Word8) -- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) import Foreign.Ptr (castPtr) -import Streamly.Internal.Data.Unbox (Unbox) -- import System.IO (Handle, hGetBufSome, hPutBuf) import System.IO (IOMode) import Prelude hiding (read) @@ -128,7 +127,7 @@ import Prelude hiding (read) import qualified GHC.IO.FD as FD import qualified GHC.IO.Device as RawIO -import Streamly.Data.Array (Array) +import Streamly.Data.Array (Array, Unbox) import Streamly.Data.Stream (Stream) import Streamly.Internal.Data.Array (byteLength, unsafeFreeze, asPtrUnsafe) @@ -149,7 +148,7 @@ import qualified Streamly.Data.Array as A import qualified Streamly.Data.Fold as FL import qualified Streamly.Internal.Data.MutArray as MArray (MutArray(..), asPtrUnsafe, pinnedNewBytes) -import qualified Streamly.Internal.Data.Stream.Chunked as AS +import qualified Streamly.Internal.Data.Array.Stream as AS import qualified Streamly.Internal.Data.Stream as S import qualified Streamly.Internal.Data.Stream as D (Stream(..), Step(..)) diff --git a/streamly.cabal b/streamly.cabal index 7acfb93ad..a067340ac 100644 --- a/streamly.cabal +++ b/streamly.cabal @@ -424,9 +424,9 @@ library , Streamly.Internal.FileSystem.FD if flag(dev) - other-modules: Streamly.Data.SmallArray + exposed-modules: Streamly.Data.SmallArray , Streamly.Internal.Data.SmallArray - , Streamly.Internal.Data.SmallArray.Type + other-modules: Streamly.Internal.Data.SmallArray.Type if os(windows) exposed-modules: Streamly.Internal.FileSystem.Event.Windows diff --git a/test/Streamly/Test/Prelude/Serial.hs b/test/Streamly/Test/Prelude/Serial.hs index b0c83b0c3..39ef45345 100644 --- a/test/Streamly/Test/Prelude/Serial.hs +++ b/test/Streamly/Test/Prelude/Serial.hs @@ -478,7 +478,7 @@ testTakeInterval :: IO Bool testTakeInterval = do r <- S.fold (FL.tee FL.head FL.last) - $ S.takeInterval (toRelTime64 takeDropTime) + $ S.takeInterval (fromIntegral takeDropTime * 10**(-9)) $ S.repeatM (threadDelay 1000 >> getTime Monotonic) checkTakeDropTime r @@ -487,7 +487,7 @@ testDropInterval = do t0 <- getTime Monotonic mt1 <- S.fold FL.head - $ S.dropInterval (toRelTime64 takeDropTime) + $ S.dropInterval (fromIntegral takeDropTime * 10**(-9)) $ S.repeatM (threadDelay 1000 >> getTime Monotonic) checkTakeDropTime (Just t0, mt1) #endif diff --git a/test/streamly-tests.cabal b/test/streamly-tests.cabal index 4e1995342..98c7e2763 100644 --- a/test/streamly-tests.cabal +++ b/test/streamly-tests.cabal @@ -216,13 +216,14 @@ common always-optimized -- Test suites in sorted order ------------------------------------------------------------------------------- -test-suite Data.List - import: test-options - type: exitcode-stdio-1.0 - main-is: Streamly/Test/Data/List.hs - cpp-options: -DUSE_STREAMLY_LIST - if !flag(dev) - buildable: False +-- The Streamly.Data.List needs to be fixed to enable this +-- test-suite Data.List +-- import: test-options +-- type: exitcode-stdio-1.0 +-- main-is: Streamly/Test/Data/List.hs +-- cpp-options: -DUSE_STREAMLY_LIST +-- if !flag(dev) +-- buildable: False test-suite Data.List.Base import: test-options