Fix build with "dev" flag on

This commit is contained in:
Harendra Kumar 2023-11-28 06:00:04 +05:30
parent e7992b4626
commit d55d68ab07
9 changed files with 58 additions and 23 deletions

View File

@ -315,11 +315,23 @@ fromStreamD str = unsafeFreeze <$> MA.fromStreamD str
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
{-# INLINE clone #-} {-# 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 clone = fmap unsafeFreeze . MA.clone . unsafeThaw
{-# INLINE pinnedClone #-} {-# 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 pinnedClone = fmap unsafeFreeze . MA.pinnedClone . unsafeThaw
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View File

@ -2098,7 +2098,13 @@ fromListRev xs = fromListRevN (Prelude.length xs) xs
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
{-# INLINE cloneAs #-} {-# 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 = cloneAs ps src =
liftIO $ do liftIO $ do
let startSrc = arrStart src let startSrc = arrStart src
@ -2108,11 +2114,23 @@ cloneAs ps src =
return $ MutArray newArrContents 0 srcLen srcLen return $ MutArray newArrContents 0 srcLen srcLen
{-# INLINE clone #-} {-# 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 clone = cloneAs Unpinned
{-# INLINE pinnedClone #-} {-# 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 pinnedClone = cloneAs Pinned
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View File

@ -271,7 +271,11 @@ instance forall a. Serialize a => Serialize [a] where
pokeList (acc + 1) o1 xs pokeList (acc + 1) o1 xs
pokeList 0 off1 val pokeList 0 off1 val
instance Serialize (Array a) where instance
#ifdef DEVBUILD
Unbox a =>
#endif
Serialize (Array a) where
{-# INLINE addSizeTo #-} {-# INLINE addSizeTo #-}
addSizeTo i (Array {..}) = i + (arrEnd - arrStart) + 8 addSizeTo i (Array {..}) = i + (arrEnd - arrStart) + 8

View File

@ -444,9 +444,10 @@ library
, Streamly.Internal.Data.Time.Clock.Type , Streamly.Internal.Data.Time.Clock.Type
if flag(dev) if flag(dev)
other-modules: exposed-modules:
Streamly.Internal.Data.StreamK.Alt Streamly.Internal.Data.StreamK.Alt
, Streamly.Internal.Data.List -- XXX Compilation needs to be fixed
-- , Streamly.Internal.Data.List
build-depends: build-depends:
-- streamly-base -- streamly-base

View File

@ -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". -- of elements use an 'Array' from either "Streamly.Data.Array.Generic" or "Streamly.Data.Array.Foreign".
{-# INLINE_NORMAL writeN #-} {-# INLINE_NORMAL writeN #-}
writeN :: MonadIO m => Int -> Fold m a (SmallArray a) 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 where

View File

@ -120,7 +120,6 @@ import Control.Monad.IO.Class (MonadIO(..))
import Data.Word (Word8) import Data.Word (Word8)
-- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) -- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
import Foreign.Ptr (castPtr) import Foreign.Ptr (castPtr)
import Streamly.Internal.Data.Unbox (Unbox)
-- import System.IO (Handle, hGetBufSome, hPutBuf) -- import System.IO (Handle, hGetBufSome, hPutBuf)
import System.IO (IOMode) import System.IO (IOMode)
import Prelude hiding (read) import Prelude hiding (read)
@ -128,7 +127,7 @@ import Prelude hiding (read)
import qualified GHC.IO.FD as FD import qualified GHC.IO.FD as FD
import qualified GHC.IO.Device as RawIO 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.Data.Stream (Stream)
import Streamly.Internal.Data.Array (byteLength, unsafeFreeze, asPtrUnsafe) 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.Data.Fold as FL
import qualified Streamly.Internal.Data.MutArray as MArray import qualified Streamly.Internal.Data.MutArray as MArray
(MutArray(..), asPtrUnsafe, pinnedNewBytes) (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 S
import qualified Streamly.Internal.Data.Stream as D import qualified Streamly.Internal.Data.Stream as D
(Stream(..), Step(..)) (Stream(..), Step(..))

View File

@ -424,9 +424,9 @@ library
, Streamly.Internal.FileSystem.FD , Streamly.Internal.FileSystem.FD
if flag(dev) if flag(dev)
other-modules: Streamly.Data.SmallArray exposed-modules: Streamly.Data.SmallArray
, Streamly.Internal.Data.SmallArray , Streamly.Internal.Data.SmallArray
, Streamly.Internal.Data.SmallArray.Type other-modules: Streamly.Internal.Data.SmallArray.Type
if os(windows) if os(windows)
exposed-modules: Streamly.Internal.FileSystem.Event.Windows exposed-modules: Streamly.Internal.FileSystem.Event.Windows

View File

@ -478,7 +478,7 @@ testTakeInterval :: IO Bool
testTakeInterval = do testTakeInterval = do
r <- r <-
S.fold (FL.tee FL.head FL.last) S.fold (FL.tee FL.head FL.last)
$ S.takeInterval (toRelTime64 takeDropTime) $ S.takeInterval (fromIntegral takeDropTime * 10**(-9))
$ S.repeatM (threadDelay 1000 >> getTime Monotonic) $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
checkTakeDropTime r checkTakeDropTime r
@ -487,7 +487,7 @@ testDropInterval = do
t0 <- getTime Monotonic t0 <- getTime Monotonic
mt1 <- mt1 <-
S.fold FL.head S.fold FL.head
$ S.dropInterval (toRelTime64 takeDropTime) $ S.dropInterval (fromIntegral takeDropTime * 10**(-9))
$ S.repeatM (threadDelay 1000 >> getTime Monotonic) $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
checkTakeDropTime (Just t0, mt1) checkTakeDropTime (Just t0, mt1)
#endif #endif

View File

@ -216,13 +216,14 @@ common always-optimized
-- Test suites in sorted order -- Test suites in sorted order
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
test-suite Data.List -- The Streamly.Data.List needs to be fixed to enable this
import: test-options -- test-suite Data.List
type: exitcode-stdio-1.0 -- import: test-options
main-is: Streamly/Test/Data/List.hs -- type: exitcode-stdio-1.0
cpp-options: -DUSE_STREAMLY_LIST -- main-is: Streamly/Test/Data/List.hs
if !flag(dev) -- cpp-options: -DUSE_STREAMLY_LIST
buildable: False -- if !flag(dev)
-- buildable: False
test-suite Data.List.Base test-suite Data.List.Base
import: test-options import: test-options