mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-09-11 08:25:40 +03:00
Re-export entire submodules from Array (#2510)
This commit is contained in:
parent
971b6680a5
commit
8b55b1a03e
@ -12,8 +12,7 @@ module Main (main) where
|
||||
|
||||
import Control.Monad (void)
|
||||
import GHC.Ptr (Ptr(..))
|
||||
|
||||
import qualified Streamly.Internal.Data.Array.Type as Array
|
||||
import qualified Streamly.Internal.Data.Array as Array
|
||||
import qualified Streamly.Internal.Data.Ring as Ring
|
||||
import qualified Data.Foldable as P
|
||||
|
||||
|
@ -33,7 +33,7 @@ import qualified Streamly.Data.Stream as Stream
|
||||
import qualified Streamly.Data.Fold as Fold
|
||||
import qualified Streamly.FileSystem.Handle as FH
|
||||
import qualified Streamly.Internal.Data.Array as A
|
||||
import qualified Streamly.Internal.Data.Array.Type as AT
|
||||
import qualified Streamly.Internal.Data.Array as AT
|
||||
import qualified Streamly.Internal.Data.Fold as FL
|
||||
import qualified Streamly.Internal.Data.Stream as IP
|
||||
import qualified Streamly.Internal.FileSystem.Handle as IFH
|
||||
|
@ -43,7 +43,7 @@ import Streamly.Internal.Data.Stream (Step(..))
|
||||
import qualified Streamly.Internal.Data.Stream as D
|
||||
import qualified Streamly.Internal.Data.Tuple.Strict as Strict
|
||||
import qualified Streamly.Internal.Data.Stream.MutChunked as MAS
|
||||
import qualified Streamly.Internal.Data.Array.Type as AT
|
||||
import qualified Streamly.Internal.Data.Array as AT
|
||||
|
||||
import Test.Inspection
|
||||
#endif
|
||||
|
@ -42,7 +42,7 @@ import Streamly.Internal.Data.Unbox (Unbox)
|
||||
import Streamly.Internal.Data.Stream.StreamD (Step(..))
|
||||
import qualified Streamly.Internal.Data.Fold as Fold
|
||||
import qualified Streamly.Internal.Data.Tuple.Strict as Strict
|
||||
import qualified Streamly.Internal.Data.Array.Type as Array
|
||||
import qualified Streamly.Internal.Data.Array as Array
|
||||
|
||||
import Test.Inspection
|
||||
#endif
|
||||
|
@ -1,6 +1,7 @@
|
||||
{- $setup
|
||||
>>> :m
|
||||
>>> :set -XFlexibleContexts
|
||||
>>> :set -XMagicHash
|
||||
>>> import Data.Function ((&))
|
||||
>>> import Data.Functor.Identity (Identity(..))
|
||||
>>> import System.IO.Unsafe (unsafePerformIO)
|
||||
@ -11,4 +12,8 @@
|
||||
>>> import qualified Streamly.Data.Array as Array
|
||||
>>> import qualified Streamly.Data.Fold as Fold
|
||||
>>> import qualified Streamly.Data.Stream as Stream
|
||||
|
||||
For APIs that have not been released yet.
|
||||
|
||||
>>> import qualified Streamly.Internal.Data.Array as Array
|
||||
-}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
For APIs that have not been released yet.
|
||||
|
||||
>>> import qualified Streamly.Internal.Data.Array.Type as Array (writeNUnsafe)
|
||||
>>> import qualified Streamly.Internal.Data.Array as Array (writeNUnsafe)
|
||||
>>> import qualified Streamly.Internal.Data.Unfold as Unfold (first)
|
||||
>>> import qualified Streamly.Internal.FileSystem.Handle as Handle
|
||||
>>> import qualified Streamly.Internal.System.IO as IO (defaultChunkSize)
|
||||
|
@ -29,7 +29,7 @@ module Streamly.Data.Array
|
||||
-- $overview
|
||||
|
||||
-- * The Array Type
|
||||
A.Array
|
||||
Array
|
||||
|
||||
-- * Construction
|
||||
-- | When performance matters, the fastest way to generate an array is
|
||||
@ -40,31 +40,31 @@ module Streamly.Data.Array
|
||||
-- 'fromList' can be used to construct an array from a string literal.
|
||||
|
||||
-- Pure List APIs
|
||||
, A.fromListN
|
||||
, A.fromList
|
||||
, fromListN
|
||||
, fromList
|
||||
|
||||
-- Monadic APIs
|
||||
, A.writeN -- drop new
|
||||
, A.write -- full buffer
|
||||
, writeN -- drop new
|
||||
, write -- full buffer
|
||||
, writeLastN -- drop old (ring buffer)
|
||||
|
||||
-- * Conversion
|
||||
-- 'GHC.Exts.toList' from "GHC.Exts" can be used to convert an array to a
|
||||
-- list.
|
||||
, A.toList
|
||||
, toList
|
||||
|
||||
-- * Unfolds
|
||||
, A.reader
|
||||
, A.readerRev
|
||||
, reader
|
||||
, readerRev
|
||||
|
||||
-- * Casting
|
||||
, cast
|
||||
, asBytes
|
||||
|
||||
-- * Random Access
|
||||
, A.length
|
||||
, length
|
||||
-- , (!!)
|
||||
, A.getIndex
|
||||
, getIndex
|
||||
|
||||
-- * Unbox Type Class
|
||||
, Unbox (..)
|
||||
@ -82,12 +82,11 @@ where
|
||||
|
||||
#include "inline.hs"
|
||||
|
||||
import Streamly.Internal.Data.Unfold (Unfold)
|
||||
import Streamly.Internal.Data.Array as A hiding (read, readRev)
|
||||
import Streamly.Internal.Data.Array.Type (pin, unpin, isPinned)
|
||||
|
||||
import Streamly.Internal.Data.Array hiding (read, readRev)
|
||||
import Streamly.Internal.Data.Unbox (Unbox (..))
|
||||
import Prelude hiding (read)
|
||||
import Streamly.Internal.Data.Unfold (Unfold)
|
||||
|
||||
import Prelude hiding (read, length)
|
||||
|
||||
#include "DocTestDataArray.hs"
|
||||
|
||||
|
@ -17,42 +17,27 @@ module Streamly.Internal.Data.Array
|
||||
-- $design
|
||||
|
||||
-- * The Array Type
|
||||
Array
|
||||
module Streamly.Internal.Data.Array.Type
|
||||
|
||||
-- * Construction
|
||||
|
||||
-- Pure List APIs
|
||||
, A.fromListN
|
||||
, A.fromList
|
||||
|
||||
-- Stream Folds
|
||||
, fromStreamN
|
||||
, fromStream
|
||||
|
||||
-- Monadic Folds
|
||||
, A.writeN -- drop new
|
||||
, A.pinnedWriteNAligned
|
||||
, A.write -- full buffer
|
||||
, writeLastN
|
||||
|
||||
-- * Elimination
|
||||
-- ** Conversion
|
||||
, A.toList
|
||||
|
||||
-- ** Streams
|
||||
, A.read
|
||||
, A.readRev
|
||||
|
||||
-- ** Unfolds
|
||||
, reader
|
||||
, readerUnsafe
|
||||
, A.readerRev
|
||||
, producer -- experimental
|
||||
|
||||
-- * Random Access
|
||||
-- , (!!)
|
||||
, getIndex
|
||||
, A.unsafeIndex -- XXX Rename to getIndexUnsafe??
|
||||
, getIndexRev
|
||||
, last -- XXX getIndexLast?
|
||||
, getIndices
|
||||
@ -64,7 +49,6 @@ module Streamly.Internal.Data.Array
|
||||
-- , getIndicesUptoRev -- read from end to the given position in file
|
||||
|
||||
-- * Size
|
||||
, length
|
||||
, null
|
||||
|
||||
-- * Search
|
||||
@ -77,10 +61,7 @@ module Streamly.Internal.Data.Array
|
||||
, cast
|
||||
, asBytes
|
||||
, castUnsafe
|
||||
, asPtrUnsafe
|
||||
, asCStringUnsafe
|
||||
, A.unsafeFreeze -- asImmutableUnsafe?
|
||||
, A.unsafeThaw -- asMutableUnsafe?
|
||||
|
||||
-- * Subarrays
|
||||
, getSliceUnsafe
|
||||
@ -95,10 +76,6 @@ module Streamly.Internal.Data.Array
|
||||
-- ** Folding
|
||||
, streamFold
|
||||
, fold
|
||||
|
||||
-- * Deprecated
|
||||
, A.toStream
|
||||
, A.toStreamRev
|
||||
)
|
||||
where
|
||||
|
||||
@ -117,9 +94,6 @@ import Foreign.Storable (Storable)
|
||||
import Streamly.Internal.Data.Unbox (Unbox(..))
|
||||
import Prelude hiding (length, null, last, map, (!!), read, concat)
|
||||
|
||||
import Streamly.Internal.Data.MutArray.Type (ArrayUnsafe(..))
|
||||
import Streamly.Internal.Data.Array.Type
|
||||
(Array(..), length, asPtrUnsafe)
|
||||
import Streamly.Internal.Data.Fold.Type (Fold(..))
|
||||
import Streamly.Internal.Data.Producer.Type (Producer(..))
|
||||
import Streamly.Internal.Data.Stream (Stream)
|
||||
@ -138,6 +112,8 @@ import qualified Streamly.Internal.Data.Stream as D
|
||||
import qualified Streamly.Internal.Data.Stream as Stream
|
||||
import qualified Streamly.Internal.Data.Unfold as Unfold
|
||||
|
||||
import Streamly.Internal.Data.Array.Type
|
||||
|
||||
#include "DocTestDataArray.hs"
|
||||
|
||||
-- $design
|
||||
@ -241,7 +217,6 @@ readerUnsafe = Unfold step inject
|
||||
|
||||
-- |
|
||||
--
|
||||
-- >>> import qualified Streamly.Internal.Data.Array.Type as Array
|
||||
-- >>> null arr = Array.byteLength arr == 0
|
||||
--
|
||||
-- /Pre-release/
|
||||
@ -264,7 +239,6 @@ getIndexRev i arr =
|
||||
|
||||
-- |
|
||||
--
|
||||
-- >>> import qualified Streamly.Internal.Data.Array as Array
|
||||
-- >>> last arr = Array.getIndexRev arr 0
|
||||
--
|
||||
-- /Pre-release/
|
||||
|
@ -567,7 +567,6 @@ pinnedWrite = fmap unsafeFreeze MA.pinnedWrite
|
||||
-- could be unsafe and dangerous. This is dangerous especially when used with
|
||||
-- foldMany like operations.
|
||||
--
|
||||
-- >>> import qualified Streamly.Internal.Data.Array.Type as Array
|
||||
-- >>> unsafePureWrite = Array.unsafeMakePure Array.write
|
||||
--
|
||||
{-# INLINE unsafeMakePure #-}
|
||||
@ -595,8 +594,6 @@ fromPureStream x = unsafePerformIO $ fmap (unsafeFreeze) (MA.fromPureStream x)
|
||||
-- Note that this is completely safe when reading from Haskell string
|
||||
-- literals because they are guaranteed to be NULL terminated:
|
||||
--
|
||||
-- >>> :set -XMagicHash
|
||||
-- >>> import qualified Streamly.Internal.Data.Array.Type as Array
|
||||
-- >>> Array.toList $ Array.fromByteStr# "\1\2\3\0"#
|
||||
-- [1,2,3]
|
||||
--
|
||||
|
@ -66,11 +66,11 @@ import Data.Proxy (Proxy(..))
|
||||
import Streamly.Internal.Data.Unbox (Unbox(..))
|
||||
import GHC.Types (SPEC(..))
|
||||
import Streamly.Internal.Data.MutArray.Type (touch)
|
||||
import Streamly.Internal.Data.Array.Type (Array(..))
|
||||
import Streamly.Internal.Data.Array (Array(..))
|
||||
import Streamly.Internal.Data.Parser (Initial(..), Step(..))
|
||||
import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
|
||||
|
||||
import qualified Streamly.Internal.Data.Array as Array
|
||||
import qualified Streamly.Internal.Data.Array.Type as Array
|
||||
import qualified Streamly.Internal.Data.Fold as Fold
|
||||
import qualified Streamly.Internal.Data.Parser as ParserD
|
||||
import qualified Streamly.Internal.Data.Parser.ParserD.Type as ParserD
|
||||
|
@ -87,7 +87,6 @@ import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
|
||||
import qualified Streamly.Data.Fold as FL
|
||||
import qualified Streamly.Internal.Data.Array as A
|
||||
import qualified Streamly.Internal.Data.Array as Array
|
||||
import qualified Streamly.Internal.Data.Array.Type as A
|
||||
import qualified Streamly.Internal.Data.MutArray.Type as MA
|
||||
import qualified Streamly.Internal.Data.Stream.MutChunked as AS
|
||||
import qualified Streamly.Internal.Data.Fold.Type as FL (Fold(..), Step(..))
|
||||
|
@ -308,7 +308,6 @@ library
|
||||
-- May depend on streamly-core-stream
|
||||
, Streamly.Internal.Data.MutArray.Type
|
||||
, Streamly.Internal.Data.MutArray
|
||||
, Streamly.Internal.Data.Array.Type
|
||||
, Streamly.Internal.Data.MutArray.Generic
|
||||
|
||||
-- streamly-core-streams
|
||||
@ -430,6 +429,8 @@ library
|
||||
, Streamly.Internal.Data.Unfold.Type
|
||||
, Streamly.Internal.Data.Unfold.Enumeration
|
||||
|
||||
, Streamly.Internal.Data.Array.Type
|
||||
|
||||
if flag(dev)
|
||||
other-modules:
|
||||
Streamly.Internal.Data.Stream.StreamK.Alt
|
||||
|
@ -71,7 +71,7 @@ import Control.Concurrent (threadDelay)
|
||||
import Control.Monad.IO.Class (MonadIO(..))
|
||||
import Foreign.Storable (Storable)
|
||||
import Streamly.Internal.Control.Concurrent (MonadAsync)
|
||||
import Streamly.Internal.Data.Array.Type (Array)
|
||||
import Streamly.Internal.Data.Array (Array)
|
||||
import Streamly.Internal.Data.Fold (Fold (..))
|
||||
import Streamly.Internal.Data.Stream.IsStream.Combinators (maxYields)
|
||||
import Streamly.Internal.Data.Stream.IsStream.Type
|
||||
@ -81,7 +81,7 @@ import Streamly.Internal.Data.Time.Units (AbsTime, RelTime64, addToAbsTime64)
|
||||
import Streamly.Internal.System.IO (defaultChunkSize)
|
||||
import Streamly.Internal.Data.Unbox (Unbox)
|
||||
|
||||
import qualified Streamly.Internal.Data.Array.Type as A
|
||||
import qualified Streamly.Internal.Data.Array as A
|
||||
import qualified Streamly.Internal.Data.Stream.Async as Async
|
||||
import qualified Streamly.Internal.Data.Stream.IsStream.Type as IsStream
|
||||
import qualified Streamly.Internal.Data.Stream.Parallel as Par
|
||||
|
@ -164,7 +164,7 @@ import Streamly.Internal.Data.Fold (Fold (..))
|
||||
import Streamly.Internal.Data.IsMap (IsMap(..))
|
||||
import Streamly.Internal.Data.Refold.Type (Refold (..))
|
||||
import Streamly.Internal.Data.Parser (Parser (..), ParseError)
|
||||
import Streamly.Internal.Data.Array.Type (Array)
|
||||
import Streamly.Internal.Data.Array (Array)
|
||||
import Streamly.Internal.Data.Stream.IsStream.Common
|
||||
( fold
|
||||
, interjectSuffix
|
||||
@ -184,7 +184,7 @@ import Streamly.Internal.Data.Unbox (Unbox)
|
||||
|
||||
import qualified Data.Heap as H
|
||||
import qualified Streamly.Internal.Data.Unfold as Unfold
|
||||
import qualified Streamly.Internal.Data.Array.Type as A
|
||||
import qualified Streamly.Internal.Data.Array as A
|
||||
(chunksOf, read)
|
||||
import qualified Streamly.Internal.Data.Fold as FL
|
||||
(Fold, Step(..), takeEndBy_, takeEndBy, catMaybes, take)
|
||||
|
@ -175,7 +175,7 @@ import GHC.IO.Handle.FD (fdToHandle)
|
||||
import Streamly.Internal.Data.Stream (Stream)
|
||||
import Streamly.Internal.Data.Cont (contListMap)
|
||||
import Streamly.Internal.Data.Parser (Parser)
|
||||
import Streamly.Internal.Data.Array.Type (Array(..))
|
||||
import Streamly.Internal.Data.Array (Array(..))
|
||||
import System.IO (Handle, hClose)
|
||||
|
||||
import qualified Data.List.NonEmpty as NonEmpty
|
||||
|
@ -173,7 +173,7 @@ import GHC.IO.FD (fdFD, mkFD)
|
||||
import GHC.IO.Handle.FD (mkHandleFromFD)
|
||||
import Streamly.Internal.Data.Stream (Stream)
|
||||
import Streamly.Internal.Data.Parser (Parser)
|
||||
import Streamly.Internal.Data.Array.Type (Array(..), byteLength)
|
||||
import Streamly.Internal.Data.Array (Array(..), byteLength)
|
||||
import System.Directory (doesDirectoryExist)
|
||||
import System.IO (Handle, hClose, IOMode(ReadMode))
|
||||
import GHC.IO.Handle.FD (handleToFd)
|
||||
|
@ -128,7 +128,7 @@ import Prelude hiding (read)
|
||||
import qualified GHC.IO.FD as FD
|
||||
import qualified GHC.IO.Device as RawIO
|
||||
|
||||
import Streamly.Internal.Data.Array.Type
|
||||
import Streamly.Internal.Data.Array
|
||||
(Array(..), byteLength, unsafeFreeze, asPtrUnsafe)
|
||||
import Streamly.Internal.System.IO (defaultChunkSize)
|
||||
import Streamly.Internal.Data.Stream (Stream)
|
||||
|
@ -106,7 +106,7 @@ import Prelude hiding (read)
|
||||
|
||||
import Streamly.Internal.Control.Concurrent (MonadAsync)
|
||||
import Streamly.Internal.Control.ForkLifted (fork)
|
||||
import Streamly.Internal.Data.Array.Type (Array(..), pinnedWriteNUnsafe)
|
||||
import Streamly.Internal.Data.Array (Array(..), pinnedWriteNUnsafe)
|
||||
import Streamly.Internal.Data.Fold (Fold(..))
|
||||
import Streamly.Data.Stream (Stream)
|
||||
import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
|
||||
@ -121,7 +121,7 @@ import qualified Network.Socket as Net
|
||||
import qualified Streamly.Data.Array as A
|
||||
import qualified Streamly.Data.Fold as FL
|
||||
import qualified Streamly.Data.Unfold as UF
|
||||
import qualified Streamly.Internal.Data.Array.Type as A
|
||||
import qualified Streamly.Internal.Data.Array as A
|
||||
import qualified Streamly.Internal.Data.Unfold as UF (first, bracketIO)
|
||||
import qualified Streamly.Internal.Data.Fold as FL (Step(..), reduce)
|
||||
import qualified Streamly.Internal.Data.Stream as S
|
||||
|
@ -86,7 +86,7 @@ import Prelude hiding (read)
|
||||
|
||||
import qualified Network.Socket as Net
|
||||
|
||||
import Streamly.Internal.Data.Array.Type (Array(..))
|
||||
import Streamly.Internal.Data.Array (Array(..))
|
||||
import Streamly.Internal.Data.Stream.Chunked (lpackArraysChunksOf)
|
||||
import Streamly.Internal.Data.Fold (Fold)
|
||||
import Streamly.Internal.Data.Stream (Stream)
|
||||
@ -96,7 +96,7 @@ import Streamly.Internal.System.IO (defaultChunkSize)
|
||||
|
||||
import qualified Streamly.Data.Array as A (reader, length)
|
||||
import qualified Streamly.Data.Fold as FL
|
||||
import qualified Streamly.Internal.Data.Array.Type as A
|
||||
import qualified Streamly.Internal.Data.Array as A
|
||||
(unsafeFreeze, asPtrUnsafe, byteLength, pinnedChunksOf, pinnedWriteN, pinnedWriteNUnsafe)
|
||||
import qualified Streamly.Internal.Data.MutArray as MArray
|
||||
(MutArray(..), asPtrUnsafe, pinnedNewBytes)
|
||||
|
@ -34,7 +34,7 @@ import Streamly.Internal.Data.MutArray.Type (length)
|
||||
import Streamly.Internal.Data.SVar.Type (adaptState)
|
||||
import Streamly.Internal.Data.MutArray.Type (Array(..))
|
||||
|
||||
import qualified Streamly.Internal.Data.Array.Type as Array
|
||||
import qualified Streamly.Internal.Data.Array as Array
|
||||
import qualified Streamly.Internal.Data.MutArray.Type as MArray
|
||||
import qualified Streamly.Internal.Data.Stream as D
|
||||
-}
|
||||
|
@ -137,7 +137,7 @@ import Control.Monad.IO.Class (MonadIO(..))
|
||||
import Data.Word (Word8)
|
||||
import Network.Socket (Socket, SockAddr)
|
||||
import Streamly.Internal.Data.Unfold (Unfold(..))
|
||||
import Streamly.Internal.Data.Array.Type (Array(..))
|
||||
import Streamly.Internal.Data.Array (Array(..))
|
||||
import Streamly.Internal.Data.Unbox (Unbox)
|
||||
|
||||
import Streamly.Internal.Network.Socket hiding (accept, read, readChunks)
|
||||
|
@ -19,7 +19,6 @@ import Streamly.Internal.Data.MutArray.Type (MutArray)
|
||||
import Test.QuickCheck (chooseInt, listOf)
|
||||
|
||||
import qualified Streamly.Internal.Data.Array as A
|
||||
import qualified Streamly.Internal.Data.Array.Type as A
|
||||
import qualified Streamly.Internal.Data.MutArray.Type as MA
|
||||
|
||||
#include "Streamly/Test/Data/Array/CommonImports.hs"
|
||||
|
@ -10,7 +10,7 @@ module Streamly.Test.Data.Ring.Unboxed (main) where
|
||||
|
||||
import Control.Monad (void)
|
||||
|
||||
import qualified Streamly.Internal.Data.Array.Type as Array
|
||||
import qualified Streamly.Internal.Data.Array as Array
|
||||
import qualified Streamly.Internal.Data.Ring as Ring
|
||||
|
||||
import Prelude as P
|
||||
|
Loading…
Reference in New Issue
Block a user