mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 11:37:22 +03:00
Add clone combinators to array
This commit is contained in:
parent
88a43713fb
commit
9bda27ac9b
@ -44,6 +44,10 @@ module Streamly.Internal.Data.Array.Type
|
||||
-- * Split
|
||||
, breakOn
|
||||
|
||||
-- ** Cloning arrays
|
||||
, clone
|
||||
, pinnedClone
|
||||
|
||||
-- * Elimination
|
||||
, unsafeIndexIO
|
||||
, getIndexUnsafe
|
||||
@ -303,6 +307,18 @@ fromStreamD :: forall m a. (MonadIO m, Unbox a)
|
||||
=> D.Stream m a -> m (Array a)
|
||||
fromStreamD str = unsafeFreeze <$> MA.fromStreamD str
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Cloning
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
{-# INLINE clone #-}
|
||||
clone :: MonadIO m => Array a -> m (Array a)
|
||||
clone = fmap unsafeFreeze . MA.clone . unsafeThaw
|
||||
|
||||
{-# INLINE pinnedClone #-}
|
||||
pinnedClone :: MonadIO m => Array a -> m (Array a)
|
||||
pinnedClone = fmap unsafeFreeze . MA.pinnedClone . unsafeThaw
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Streams of arrays
|
||||
-------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user