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 #-}
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
-------------------------------------------------------------------------------

View File

@ -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
-------------------------------------------------------------------------------

View File

@ -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

View File

@ -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

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".
{-# 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

View File

@ -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(..))

View File

@ -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

View File

@ -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

View File

@ -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