Rename Data.Array.Storable.Foreign to Data.Array.Foreign.

Closes #854.
This commit is contained in:
Pranay Sashank 2021-02-01 12:03:57 +05:30
parent 08dd169aae
commit 5c018c7e45
62 changed files with 161 additions and 162 deletions

View File

@ -30,7 +30,7 @@ test/Streamly/Test/Common/Array.hs
test/Streamly/Test/Data/Array.hs test/Streamly/Test/Data/Array.hs
test/Streamly/Test/Data/Array/Prim.hs test/Streamly/Test/Data/Array/Prim.hs
test/Streamly/Test/Data/Array/Prim/Pinned.hs test/Streamly/Test/Data/Array/Prim/Pinned.hs
test/Streamly/Test/Data/Array/Storable/Foreign.hs test/Streamly/Test/Data/Array/Foreign.hs
test/Streamly/Test/Data/Parser.hs test/Streamly/Test/Data/Parser.hs
test/Streamly/Test/Data/Parser/ParserD.hs test/Streamly/Test/Data/Parser/ParserD.hs
test/Streamly/Test/Data/SmallArray.hs test/Streamly/Test/Data/SmallArray.hs

View File

@ -52,7 +52,7 @@
### Deprecations ### Deprecations
* Deprecate `Streamly.Memory.Array` in favor of * Deprecate `Streamly.Memory.Array` in favor of
`Streamly.Data.Array.Storable.Foreign` `Streamly.Data.Array.Foreign`
* Deprecate `Streamly.Data.Unicode.Stream` in favor of * Deprecate `Streamly.Data.Unicode.Stream` in favor of
`Streamly.Unicode.Stream` `Streamly.Unicode.Stream`
* The `Streamly` module is now deprecated, its functionality is subsumed * The `Streamly` module is now deprecated, its functionality is subsumed

View File

@ -362,7 +362,7 @@ documentation.
## Arrays ## Arrays
The `Streamly.Data.Array.Storable.Foreign` module provides immutable arrays. Arrays are the The `Streamly.Data.Array.Foreign` module provides immutable arrays. Arrays are the
computing duals of streams. Streams are good at sequential access and immutable computing duals of streams. Streams are good at sequential access and immutable
transformations of in-transit data whereas arrays are good at random access and transformations of in-transit data whereas arrays are good at random access and
in-place transformations of buffered data. Unlike streams which are potentially in-place transformations of buffered data. Unlike streams which are potentially
@ -373,7 +373,7 @@ computing system. The design of streamly as a general purpose computing
framework is centered around these two fundamental aspects of computing and framework is centered around these two fundamental aspects of computing and
storage. storage.
`Streamly.Data.Array.Storable.Foreign` uses pinned memory outside GC and therefore avoid any `Streamly.Data.Array.Foreign` uses pinned memory outside GC and therefore avoid any
GC overhead for the storage in arrays. Streamly allows efficient GC overhead for the storage in arrays. Streamly allows efficient
transformations over arrays using streams. It uses arrays to transfer data to transformations over arrays using streams. It uses arrays to transfer data to
and from the operating system and to store data in memory. and from the operating system and to store data in memory.
@ -416,7 +416,7 @@ module Main where
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import qualified Streamly.Data.Fold as FL import qualified Streamly.Data.Fold as FL
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.FileSystem.Handle as FH import qualified Streamly.FileSystem.Handle as FH
import qualified System.IO as FH import qualified System.IO as FH

View File

@ -9,7 +9,7 @@
import Streamly.Prelude (SerialT) import Streamly.Prelude (SerialT)
import Streamly.Internal.Data.SVar (MonadAsync) import Streamly.Internal.Data.SVar (MonadAsync)
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.FileSystem.Handle as FH import qualified Streamly.FileSystem.Handle as FH
import qualified Streamly.Internal.FileSystem.Handle as IFH import qualified Streamly.Internal.FileSystem.Handle as IFH
import qualified Streamly.Data.Fold as FL import qualified Streamly.Data.Fold as FL

View File

@ -12,8 +12,8 @@ import Control.DeepSeq (NFData(..))
import System.Random (randomRIO) import System.Random (randomRIO)
import qualified Streamly.Benchmark.Data.ArrayOps as Ops import qualified Streamly.Benchmark.Data.ArrayOps as Ops
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Array.Storable.Foreign as IA import qualified Streamly.Internal.Data.Array.Foreign as IA
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import Gauge import Gauge

View File

@ -35,8 +35,8 @@ import qualified Streamly.Internal.Data.SmallArray as A
type Stream = A.SmallArray type Stream = A.SmallArray
#elif defined(MEMORY_ARRAY) #elif defined(MEMORY_ARRAY)
import qualified GHC.Exts as GHC import qualified GHC.Exts as GHC
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
type Stream = A.Array type Stream = A.Array
#elif defined(DATA_ARRAY_PRIM) #elif defined(DATA_ARRAY_PRIM)
import qualified Streamly.Internal.Data.Array.Prim as A import qualified Streamly.Internal.Data.Array.Prim as A

View File

@ -33,8 +33,8 @@ import GHC.Magic (noinline)
import System.IO (Handle) import System.IO (Handle)
import qualified Streamly.FileSystem.Handle as FH import qualified Streamly.FileSystem.Handle as FH
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as AT import qualified Streamly.Internal.Data.Array.Foreign.Types as AT
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser as PR import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Internal.Data.Stream.IsStream as IP import qualified Streamly.Internal.Data.Stream.IsStream as IP
@ -51,7 +51,7 @@ import Streamly.Benchmark.Common.Handle
#ifdef INSPECTION #ifdef INSPECTION
import Streamly.Internal.Data.Stream.StreamD.Type (Step(..), GroupState) import Streamly.Internal.Data.Stream.StreamD.Type (Step(..), GroupState)
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types as MA import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
import qualified Streamly.Internal.Data.Stream.StreamD as D import qualified Streamly.Internal.Data.Stream.StreamD as D
import qualified Streamly.Internal.Data.Unfold as IUF import qualified Streamly.Internal.Data.Unfold as IUF

View File

@ -24,13 +24,13 @@ where
import System.IO (Handle) import System.IO (Handle)
import Prelude hiding (last, length) import Prelude hiding (last, length)
import Streamly.Internal.Data.Array.Storable.Foreign.Types (defaultChunkSize) import Streamly.Internal.Data.Array.Foreign.Types (defaultChunkSize)
import qualified Streamly.FileSystem.Handle as FH import qualified Streamly.FileSystem.Handle as FH
import qualified Streamly.Internal.Data.Unfold as IUF import qualified Streamly.Internal.Data.Unfold as IUF
import qualified Streamly.Internal.FileSystem.Handle as IFH import qualified Streamly.Internal.FileSystem.Handle as IFH
import qualified Streamly.Internal.Memory.ArrayStream as AS import qualified Streamly.Internal.Memory.ArrayStream as AS
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import Gauge hiding (env) import Gauge hiding (env)
@ -43,8 +43,8 @@ import Streamly.Internal.Data.Stream.StreamD.Type (Step(..))
import qualified Streamly.Internal.Data.Stream.StreamD.Type as D import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
import qualified Streamly.Internal.Data.Tuple.Strict as Strict import qualified Streamly.Internal.Data.Tuple.Strict as Strict
import qualified Streamly.Internal.Data.Array.Stream.Mut.Foreign as MAS import qualified Streamly.Internal.Data.Array.Stream.Mut.Foreign as MAS
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as AT import qualified Streamly.Internal.Data.Array.Foreign.Types as AT
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types as MA import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
import Test.Inspection import Test.Inspection
#endif #endif

View File

@ -25,7 +25,7 @@ import Data.Word (Word8)
import System.IO (Handle) import System.IO (Handle)
import qualified Streamly.FileSystem.Handle as FH import qualified Streamly.FileSystem.Handle as FH
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser as PR import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Internal.Data.Stream.IsStream as IP import qualified Streamly.Internal.Data.Stream.IsStream as IP
@ -41,7 +41,7 @@ import Streamly.Benchmark.Common.Handle
#ifdef INSPECTION #ifdef INSPECTION
import Streamly.Internal.Data.Stream.StreamD.Type (Step(..)) import Streamly.Internal.Data.Stream.StreamD.Type (Step(..))
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types as MA import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
import qualified Streamly.Internal.Data.Unfold as IUF import qualified Streamly.Internal.Data.Unfold as IUF
import Test.Inspection import Test.Inspection
@ -229,4 +229,3 @@ benchmarks moduleName env =
, o_1_space_reduce_toChunks_split env , o_1_space_reduce_toChunks_split env
] ]
] ]

View File

@ -29,7 +29,7 @@ import qualified Streamly.Internal.Unicode.Stream as IUS
import qualified Streamly.Internal.FileSystem.Handle as IFH import qualified Streamly.Internal.FileSystem.Handle as IFH
import qualified Streamly.Internal.Unicode.Array.Char as IUA import qualified Streamly.Internal.Unicode.Array.Char as IUA
import qualified Streamly.Internal.Data.Stream.IsStream as IP import qualified Streamly.Internal.Data.Stream.IsStream as IP
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import Gauge hiding (env) import Gauge hiding (env)
@ -40,8 +40,8 @@ import Streamly.Benchmark.Common.Handle
import Foreign.Storable (Storable) import Foreign.Storable (Storable)
import Streamly.Internal.Data.Stream.StreamD.Type (Step(..)) import Streamly.Internal.Data.Stream.StreamD.Type (Step(..))
import qualified Streamly.Internal.Data.Tuple.Strict as Strict import qualified Streamly.Internal.Data.Tuple.Strict as Strict
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as AT import qualified Streamly.Internal.Data.Array.Foreign.Types as AT
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types as MA import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
import Test.Inspection import Test.Inspection
#endif #endif

View File

@ -162,7 +162,7 @@ common bench-options-threaded
benchmark Prelude.Serial benchmark Prelude.Serial
import: bench-options import: bench-options
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
hs-source-dirs: Streamly/Benchmark/Prelude hs-source-dirs: Streamly/Benchmark/Prelude
main-is: Serial.hs main-is: Serial.hs
other-modules: other-modules:
Serial.Generation Serial.Generation
@ -432,7 +432,7 @@ benchmark Data.Array.Prim.Pinned
other-modules: Streamly.Benchmark.Data.ArrayOps other-modules: Streamly.Benchmark.Data.ArrayOps
cpp-options: -DDATA_ARRAY_PRIM_PINNED cpp-options: -DDATA_ARRAY_PRIM_PINNED
benchmark Data.Array.Storable.Foreign benchmark Data.Array.Foreign
import: bench-options import: bench-options
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
hs-source-dirs: . hs-source-dirs: .
@ -461,7 +461,7 @@ benchmark Unicode.Stream
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
hs-source-dirs: Streamly/Benchmark/Unicode hs-source-dirs: Streamly/Benchmark/Unicode
main-is: Stream.hs main-is: Stream.hs
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- benchmark comparison and presentation -- benchmark comparison and presentation
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View File

@ -34,7 +34,7 @@ prelude_other_grp="\
array_grp="\ array_grp="\
Data.Array \ Data.Array \
Data.Array.Storable.Foreign \ Data.Array.Foreign \
Data.Array.Prim \ Data.Array.Prim \
Data.SmallArray \ Data.SmallArray \
Data.Array.Prim.Pinned" Data.Array.Prim.Pinned"

View File

@ -143,9 +143,9 @@ conflict with any other module on Hackage.
We have the following module hierarchy under Streamly: We have the following module hierarchy under Streamly:
* Data: This is a generic bucket for basic data structures a la the `base` * Data: This is a generic bucket for basic data structures a la the `base`
package's `Data` hierarchy. package's `Data` hierarchy.
* Streamly.Data.Array * Streamly.Data.Array
Streams can be classified under `Data` or `Control`. Though they are Streams can be classified under `Data` or `Control`. Though they are
mostly used for processing, they can also be used to store data in mostly used for processing, they can also be used to store data in
memory. memory.
@ -216,7 +216,7 @@ Similarly, the immutable Array modules would go in:
* `Streamly.Data.Array` -- unpinned, native memory arrays * `Streamly.Data.Array` -- unpinned, native memory arrays
* `Streamly.Data.Array.Storable` -- unpinned, unboxed, native memory arrays * `Streamly.Data.Array.Storable` -- unpinned, unboxed, native memory arrays
* `Streamly.Data.Array.Storable.Pinned` -- pinned, unboxed, native memory arrays * `Streamly.Data.Array.Storable.Pinned` -- pinned, unboxed, native memory arrays
* `Streamly.Data.Array.Storable.Foreign` -- pinned, unboxed, foreign capable arrays * `Streamly.Data.Array.Foreign` -- pinned, unboxed, foreign capable arrays
Unboxed arrays, based on `Prim` type class: Unboxed arrays, based on `Prim` type class:

View File

@ -317,7 +317,7 @@ consume as arguments. This means `StreamD` combinators should not be marked
as `INLINE` or `INLINE_EARLY`, instead they should all be marked as as `INLINE` or `INLINE_EARLY`, instead they should all be marked as
`INLINE_NORMAL` because higher order functions like `concatMap`/`map`/`mapM` `INLINE_NORMAL` because higher order functions like `concatMap`/`map`/`mapM`
etc are marked as `INLINE_NORMAL`. `StreamD` functions in other modules like etc are marked as `INLINE_NORMAL`. `StreamD` functions in other modules like
`Streamly.Data.Array.Storable.Foreign` should also follow the same rules. `Streamly.Data.Array.Foreign` should also follow the same rules.
## Stream Fusion ## Stream Fusion

View File

@ -48,8 +48,8 @@ cradle:
cabal: cabal:
- path: "./test/Streamly/Test/Data/Array.hs" - path: "./test/Streamly/Test/Data/Array.hs"
component: "test:Data.Array" component: "test:Data.Array"
- path: "./test/Streamly/Test/Data/Array/Storable/Foreign.hs" - path: "./test/Streamly/Test/Data/Array/Foreign.hs"
component: "Data.Array.Storable.Foreign" component: "Data.Array.Foreign"
- path: "./test/Streamly/Test/Data/Fold.hs" - path: "./test/Streamly/Test/Data/Fold.hs"
component: "test:Data.Fold" component: "test:Data.Fold"
- path: "./test/Streamly/Test/Data/List.hs" - path: "./test/Streamly/Test/Data/List.hs"

View File

@ -244,7 +244,7 @@ import qualified Streamly.Internal.Data.Stream.Async as Async
-- > S.length $ S.splitOnSuffix FL.drain 10 $ FH.read fh -- > S.length $ S.splitOnSuffix FL.drain 10 $ FH.read fh
-- --
-- The following example folds the lines to arrays of 'Word8' using the -- The following example folds the lines to arrays of 'Word8' using the
-- 'Streamly.Data.Array.Storable.Foreign.writeF' fold and then wraps the lines in square -- 'Streamly.Data.Array.Foreign.writeF' fold and then wraps the lines in square
-- brackets before writing them to standard output using -- brackets before writing them to standard output using
-- 'Streamly.FileSystem.Handle.write': -- 'Streamly.FileSystem.Handle.write':
-- --
@ -295,7 +295,7 @@ import qualified Streamly.Internal.Data.Stream.Async as Async
-- $arrays -- $arrays
-- --
-- Streamly arrays (See "Streamly.Data.Array.Storable.Foreign") complement streams to provide an -- Streamly arrays (See "Streamly.Data.Array.Foreign") complement streams to provide an
-- efficient computing paradigm. Streams are suitable for immutable -- efficient computing paradigm. Streams are suitable for immutable
-- transformations of /potentially infinite/ data using /sequential access/ and -- transformations of /potentially infinite/ data using /sequential access/ and
-- pipelined transformations whereas arrays are suitable for in-place -- pipelined transformations whereas arrays are suitable for in-place

View File

@ -1,7 +1,7 @@
#include "inline.hs" #include "inline.hs"
-- | -- |
-- Module : Streamly.Data.Array.Storable.Foreign -- Module : Streamly.Data.Array.Foreign
-- Copyright : (c) 2019 Composewell Technologies -- Copyright : (c) 2019 Composewell Technologies
-- --
-- License : BSD3 -- License : BSD3
@ -32,9 +32,9 @@
-- --
-- > import qualified Streamly.Array as A -- > import qualified Streamly.Array as A
-- --
-- For experimental APIs see "Streamly.Internal.Data.Array.Storable.Foreign". -- For experimental APIs see "Streamly.Internal.Data.Array.Foreign".
module Streamly.Data.Array.Storable.Foreign module Streamly.Data.Array.Foreign
( (
A.Array A.Array
@ -70,4 +70,4 @@ module Streamly.Data.Array.Storable.Foreign
) )
where where
import Streamly.Internal.Data.Array.Storable.Foreign as A import Streamly.Internal.Data.Array.Foreign as A

View File

@ -12,11 +12,11 @@
-- A 'Char' stream is the canonical representation to process Unicode strings. -- A 'Char' stream is the canonical representation to process Unicode strings.
-- It can be processed efficiently using regular stream processing operations. -- It can be processed efficiently using regular stream processing operations.
-- A byte stream of Unicode text read from an IO device or from an -- A byte stream of Unicode text read from an IO device or from an
-- 'Streamly.Data.Array.Storable.Foreign.Array' in memory can be decoded into a 'Char' stream -- 'Streamly.Data.Array.Foreign.Array' in memory can be decoded into a 'Char' stream
-- using the decoding routines in this module. A 'String' (@[Char]@) can be -- using the decoding routines in this module. A 'String' (@[Char]@) can be
-- converted into a 'Char' stream using 'Streamly.Prelude.fromList'. An @Array -- converted into a 'Char' stream using 'Streamly.Prelude.fromList'. An @Array
-- Char@ can be 'Streamly.Prelude.unfold'ed into a stream using the array -- Char@ can be 'Streamly.Prelude.unfold'ed into a stream using the array
-- 'Streamly.Data.Array.Storable.Foreign.read' unfold. -- 'Streamly.Data.Array.Foreign.read' unfold.
-- --
-- = Storing Unicode Strings -- = Storing Unicode Strings
-- --
@ -30,7 +30,7 @@
-- than pinned arrays for short and short lived strings. -- than pinned arrays for short and short lived strings.
-- --
-- For longer or long lived streams you can 'Streamly.Prelude.fold' the 'Char' -- For longer or long lived streams you can 'Streamly.Prelude.fold' the 'Char'
-- stream as @Array Char@ using the array 'Streamly.Data.Array.Storable.Foreign.write' fold. -- stream as @Array Char@ using the array 'Streamly.Data.Array.Foreign.write' fold.
-- The 'Array' type provides a more compact representation and pinned memory -- The 'Array' type provides a more compact representation and pinned memory
-- reducing GC overhead. If space efficiency is a concern you can use -- reducing GC overhead. If space efficiency is a concern you can use
-- 'encodeUtf8'' on the 'Char' stream before writing it to an 'Array' providing -- 'encodeUtf8'' on the 'Char' stream before writing it to an 'Array' providing

View File

@ -25,7 +25,7 @@
-- --
-- Reading and writing APIs are divided into two categories, sequential -- Reading and writing APIs are divided into two categories, sequential
-- streaming APIs and random or seekable access APIs. File IO APIs are quite -- streaming APIs and random or seekable access APIs. File IO APIs are quite
-- similar to "Streamly.Data.Array.Storable.Foreign" read write APIs. In that regard, arrays can -- similar to "Streamly.Data.Array.Foreign" read write APIs. In that regard, arrays can
-- be considered as in-memory files or files can be considered as on-disk -- be considered as in-memory files or files can be considered as on-disk
-- arrays. -- arrays.
-- --
@ -130,8 +130,8 @@ 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.Internal.Data.Array.Storable.Foreign.Types (Array(..), byteLength, defaultChunkSize, unsafeFreeze) import Streamly.Internal.Data.Array.Foreign.Types (Array(..), byteLength, defaultChunkSize, unsafeFreeze)
import Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types (mutableArray) import Streamly.Internal.Data.Array.Foreign.Mut.Types (mutableArray)
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
import Streamly.Internal.Data.Stream.StreamK.Type (IsStream, mkStream) import Streamly.Internal.Data.Stream.StreamK.Type (IsStream, mkStream)
@ -145,7 +145,7 @@ import qualified Streamly.FileSystem.FDIO as RawIO hiding (write)
-- import Streamly.Data.Fold (Fold) -- import Streamly.Data.Fold (Fold)
-- import Streamly.String (encodeUtf8, decodeUtf8, foldLines) -- import Streamly.String (encodeUtf8, decodeUtf8, foldLines)
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Internal.Memory.ArrayStream as AS import qualified Streamly.Internal.Memory.ArrayStream as AS
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import qualified Streamly.Internal.Data.Stream.StreamD.Type as D import qualified Streamly.Internal.Data.Stream.StreamD.Type as D

View File

@ -10,7 +10,7 @@
-- Portability : GHC -- Portability : GHC
-- --
-- Read and write streams and arrays to and from file handles. File handle IO -- Read and write streams and arrays to and from file handles. File handle IO
-- APIs are quite similar to "Streamly.Data.Array.Storable.Foreign" read write APIs. In that -- APIs are quite similar to "Streamly.Data.Array.Foreign" read write APIs. In that
-- regard, arrays can be considered as in-memory files or files can be -- regard, arrays can be considered as in-memory files or files can be
-- considered as on-disk arrays. -- considered as on-disk arrays.
-- --
@ -44,12 +44,12 @@ module Streamly.FileSystem.Handle
-- the stream is lazy and generated on-demand as the consumer consumes it. -- the stream is lazy and generated on-demand as the consumer consumes it.
-- Read IO requests to the IO device are performed in chunks limited to a -- Read IO requests to the IO device are performed in chunks limited to a
-- maximum size of 32KiB, this is referred to as -- maximum size of 32KiB, this is referred to as
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize' in the -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize' in the
-- documentation. One IO request may or may not read the full -- documentation. One IO request may or may not read the full
-- chunk. If the whole stream is not consumed, it is possible that we may -- chunk. If the whole stream is not consumed, it is possible that we may
-- read slightly more from the IO device than what the consumer needed. -- read slightly more from the IO device than what the consumer needed.
-- Unless specified otherwise in the API, writes are collected into chunks -- Unless specified otherwise in the API, writes are collected into chunks
-- of 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize' before they -- of 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize' before they
-- are written to the IO device. -- are written to the IO device.
-- Streaming APIs work for all kind of devices, seekable or non-seekable; -- Streaming APIs work for all kind of devices, seekable or non-seekable;

View File

@ -3,7 +3,7 @@
#include "inline.hs" #include "inline.hs"
-- | -- |
-- Module : Streamly.Internal.Data.Array.Storable.Foreign -- Module : Streamly.Internal.Data.Array.Foreign
-- Copyright : (c) 2019 Composewell Technologies -- Copyright : (c) 2019 Composewell Technologies
-- --
-- License : BSD3 -- License : BSD3
@ -32,7 +32,7 @@
-- if we use one array for each chunk. This is still significant to add -- if we use one array for each chunk. This is still significant to add
-- pressure to GC. -- pressure to GC.
module Streamly.Internal.Data.Array.Storable.Foreign module Streamly.Internal.Data.Array.Foreign
( (
Array Array
@ -156,14 +156,14 @@ import GHC.Ptr (Ptr(..))
import GHC.Prim (touch#) import GHC.Prim (touch#)
import GHC.IO (IO(..)) import GHC.IO (IO(..))
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array(..), length) import Streamly.Internal.Data.Array.Foreign.Types (Array(..), length)
import Streamly.Internal.Data.Fold.Types (Fold(..)) import Streamly.Internal.Data.Fold.Types (Fold(..))
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
import Streamly.Internal.Data.Tuple.Strict (Tuple3'(..)) import Streamly.Internal.Data.Tuple.Strict (Tuple3'(..))
import Streamly.Internal.Data.Unfold.Types (Unfold(..)) import Streamly.Internal.Data.Unfold.Types (Unfold(..))
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types as MA import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Stream.Prelude as P import qualified Streamly.Internal.Data.Stream.Prelude as P
import qualified Streamly.Internal.Data.Stream.Serial as Serial import qualified Streamly.Internal.Data.Stream.Serial as Serial

View File

@ -1,7 +1,7 @@
{-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE UnboxedTuples #-}
-- | -- |
-- Module : Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types -- Module : Streamly.Internal.Data.Array.Foreign.Mut.Types
-- Copyright : (c) 2020 Composewell Technologies -- Copyright : (c) 2020 Composewell Technologies
-- License : BSD3-3-Clause -- License : BSD3-3-Clause
-- Maintainer : streamly@composewell.com -- Maintainer : streamly@composewell.com
@ -22,7 +22,7 @@
-- Stream and Fold APIs allow easy, efficient and convenient operations on -- Stream and Fold APIs allow easy, efficient and convenient operations on
-- arrays. -- arrays.
module Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types module Streamly.Internal.Data.Array.Foreign.Mut.Types
( (
-- * Type -- * Type
-- $arrayNotes -- $arrayNotes
@ -459,7 +459,7 @@ arraysOf n (D.Stream step state) =
step' _ (GroupStart st) = do step' _ (GroupStart st) = do
when (n <= 0) $ when (n <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ "Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types.fromStreamDArraysOf: the size of " error $ "Streamly.Internal.Data.Array.Foreign.Mut.Types.fromStreamDArraysOf: the size of "
++ "arrays [" ++ show n ++ "] must be a natural number" ++ "arrays [" ++ show n ++ "] must be a natural number"
Array start end bound <- liftIO $ newArray n Array start end bound <- liftIO $ newArray n
return $ D.Skip (GroupBuffer st start end bound) return $ D.Skip (GroupBuffer st start end bound)

View File

@ -1,7 +1,7 @@
#include "inline.hs" #include "inline.hs"
-- | -- |
-- Module : Streamly.Internal.Data.Array.Storable.Foreign.Types -- Module : Streamly.Internal.Data.Array.Foreign.Types
-- Copyright : (c) 2020 Composewell Technologies -- Copyright : (c) 2020 Composewell Technologies
-- --
-- License : BSD3-3-Clause -- License : BSD3-3-Clause
@ -9,9 +9,9 @@
-- Stability : experimental -- Stability : experimental
-- Portability : GHC -- Portability : GHC
-- --
-- See notes in "Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types" -- See notes in "Streamly.Internal.Data.Array.Foreign.Mut.Types"
-- --
module Streamly.Internal.Data.Array.Storable.Foreign.Types module Streamly.Internal.Data.Array.Foreign.Types
( (
-- $arrayNotes -- $arrayNotes
Array (..) Array (..)
@ -101,7 +101,7 @@ import Text.Read (readPrec, readListPrec, readListPrecDefault)
import Prelude hiding (length, foldr, read, unlines, splitAt) import Prelude hiding (length, foldr, read, unlines, splitAt)
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types as MA import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
import qualified Streamly.Internal.Data.Stream.StreamD.Type as D import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
import qualified Streamly.Internal.Data.Stream.StreamK.Type as K import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
import qualified GHC.Exts as Exts import qualified GHC.Exts as Exts

View File

@ -266,7 +266,7 @@ fromStreamDArraysOf n (D.Stream step state) = D.Stream step' (GroupStart state)
when (n <= 0) $ when (n <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ error $
"Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types.fromStreamDArraysOf: the size of " ++ "Streamly.Internal.Data.Array.Foreign.Mut.Types.fromStreamDArraysOf: the size of " ++
"arrays [" ++ show n ++ "] must be a natural number" "arrays [" ++ show n ++ "] must be a natural number"
arr <- newArray n arr <- newArray n
return $ D.Skip (GroupBuffer st arr 0) return $ D.Skip (GroupBuffer st arr 0)
@ -319,7 +319,7 @@ packArraysChunksOf n (D.Stream step state) =
step' gst (SpliceInitial st) = do step' gst (SpliceInitial st) = do
when (n <= 0) $ when (n <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ "Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types.packArraysChunksOf: the size of " error $ "Streamly.Internal.Data.Array.Foreign.Mut.Types.packArraysChunksOf: the size of "
++ "arrays [" ++ show n ++ "] must be a natural number" ++ "arrays [" ++ show n ++ "] must be a natural number"
r <- step gst st r <- step gst st
case r of case r of
@ -364,7 +364,7 @@ lpackArraysChunksOf n (Fold step1 initial1 extract1) =
when (n <= 0) when (n <= 0)
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
$ error $ error
$ "Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types." $ "Streamly.Internal.Data.Array.Foreign.Mut.Types."
++ "packArraysChunksOf: the size of arrays [" ++ "packArraysChunksOf: the size of arrays ["
++ show n ++ show n
++ "] must be a natural number" ++ "] must be a natural number"

View File

@ -552,7 +552,7 @@ packArraysChunksOf n (D.Stream step state) =
step' gst (SpliceInitial st) = do step' gst (SpliceInitial st) = do
when (n <= 0) $ when (n <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ "Streamly.Internal.Data.Array.Storable.Foreign.Types.packArraysChunksOf: the size of " error $ "Streamly.Internal.Data.Array.Foreign.Types.packArraysChunksOf: the size of "
++ "arrays [" ++ show n ++ "] must be a natural number" ++ "arrays [" ++ show n ++ "] must be a natural number"
r <- step gst st r <- step gst st
case r of case r of
@ -602,7 +602,7 @@ lpackArraysChunksOf n (Fold step1 initial1 extract1) =
initial = do initial = do
when (n <= 0) $ when (n <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ "Streamly.Internal.Data.Array.Storable.Foreign.Types.packArraysChunksOf: the size of " error $ "Streamly.Internal.Data.Array.Foreign.Types.packArraysChunksOf: the size of "
++ "arrays [" ++ show n ++ "] must be a natural number" ++ "arrays [" ++ show n ++ "] must be a natural number"
res <- initial1 res <- initial1
return $ first (Tuple3' Nothing' 0) res return $ first (Tuple3' Nothing' 0) res

View File

@ -37,16 +37,16 @@ import Foreign.Storable (Storable(..))
import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
import Foreign.Ptr (castPtr) import Foreign.Ptr (castPtr)
import Streamly.FileSystem.FDIO (IOVec(..)) import Streamly.FileSystem.FDIO (IOVec(..))
import Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types (length) import Streamly.Internal.Data.Array.Foreign.Mut.Types (length)
import Streamly.Internal.Data.SVar (adaptState) import Streamly.Internal.Data.SVar (adaptState)
#endif #endif
import Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types (Array(..)) import Streamly.Internal.Data.Array.Foreign.Mut.Types (Array(..))
import Streamly.Internal.Data.Fold.Types (Fold(..)) import Streamly.Internal.Data.Fold.Types (Fold(..))
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
import Streamly.Internal.Data.Stream.StreamK.Type (IsStream) import Streamly.Internal.Data.Stream.StreamK.Type (IsStream)
import Streamly.Internal.Data.Tuple.Strict (Tuple'(..)) import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types as MArray import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MArray
import qualified Streamly.Internal.Data.Fold.Types as FL import qualified Streamly.Internal.Data.Fold.Types as FL
import qualified Streamly.Internal.Data.Stream.StreamD as D import qualified Streamly.Internal.Data.Stream.StreamD as D
@ -99,7 +99,7 @@ packArraysChunksOf n (D.Stream step state) =
step' gst (SpliceInitial st) = do step' gst (SpliceInitial st) = do
when (n <= 0) $ when (n <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ "Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types.packArraysChunksOf: the size of " error $ "Streamly.Internal.Data.Array.Foreign.Mut.Types.packArraysChunksOf: the size of "
++ "arrays [" ++ show n ++ "] must be a natural number" ++ "arrays [" ++ show n ++ "] must be a natural number"
r <- step gst st r <- step gst st
case r of case r of
@ -143,7 +143,7 @@ lpackArraysChunksOf n (Fold step1 initial1 extract1) =
initial = do initial = do
when (n <= 0) $ when (n <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ "Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types.packArraysChunksOf: the size of " error $ "Streamly.Internal.Data.Array.Foreign.Mut.Types.packArraysChunksOf: the size of "
++ "arrays [" ++ show n ++ "] must be a natural number" ++ "arrays [" ++ show n ++ "] must be a natural number"
r <- initial1 r <- initial1
@ -264,11 +264,11 @@ groupIOVecsOf n maxIOVLen (D.Stream step state) =
step' gst (GatherInitial st) = do step' gst (GatherInitial st) = do
when (n <= 0) $ when (n <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ "Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types.groupIOVecsOf: the size of " error $ "Streamly.Internal.Data.Array.Foreign.Mut.Types.groupIOVecsOf: the size of "
++ "groups [" ++ show n ++ "] must be a natural number" ++ "groups [" ++ show n ++ "] must be a natural number"
when (maxIOVLen <= 0) $ when (maxIOVLen <= 0) $
-- XXX we can pass the module string from the higher level API -- XXX we can pass the module string from the higher level API
error $ "Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types.groupIOVecsOf: the number of " error $ "Streamly.Internal.Data.Array.Foreign.Mut.Types.groupIOVecsOf: the number of "
++ "IOVec entries [" ++ show n ++ "] must be a natural number" ++ "IOVec entries [" ++ show n ++ "] must be a natural number"
r <- step (adaptState gst) st r <- step (adaptState gst) st
case r of case r of

View File

@ -32,7 +32,7 @@ import Streamly.Internal.Data.Parser (Parser)
import Streamly.Internal.Data.Maybe.Strict (Maybe'(..)) import Streamly.Internal.Data.Maybe.Strict (Maybe'(..))
import Streamly.Internal.Data.Tuple.Strict (Tuple' (..)) import Streamly.Internal.Data.Tuple.Strict (Tuple' (..))
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Parser as PR import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Internal.Data.Parser.ParserD as PRD import qualified Streamly.Internal.Data.Parser.ParserD as PRD
import qualified Streamly.Internal.Data.Parser.ParserK.Types as PRK import qualified Streamly.Internal.Data.Parser.ParserK.Types as PRK

View File

@ -420,7 +420,7 @@ simplify (Fold2 step inject extract) c =
-- | Folds the input stream to a list. -- | Folds the input stream to a list.
-- --
-- /Warning!/ working on large lists accumulated as buffers in memory could be -- /Warning!/ working on large lists accumulated as buffers in memory could be
-- very inefficient, consider using "Streamly.Data.Array.Storable.Foreign" -- very inefficient, consider using "Streamly.Data.Array.Foreign"
-- instead. -- instead.
-- --
-- @since 0.7.0 -- @since 0.7.0

View File

@ -246,7 +246,7 @@ import Prelude
-- import Streamly.Data.Fold.Types (Fold(..)) -- import Streamly.Data.Fold.Types (Fold(..))
import Streamly.Internal.Data.Pipe.Types import Streamly.Internal.Data.Pipe.Types
(Pipe(..), PipeState(..), Step(..), zipWith, tee, map, compose) (Pipe(..), PipeState(..), Step(..), zipWith, tee, map, compose)
-- import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array) -- import Streamly.Internal.Data.Array.Foreign.Types (Array)
-- import Streamly.Memory.Ring (Ring) -- import Streamly.Memory.Ring (Ring)
-- import Streamly.Internal.Data.Stream.Serial (SerialT) -- import Streamly.Internal.Data.Stream.Serial (SerialT)
-- import Streamly.Internal.Data.Stream.StreamK (IsStream()) -- import Streamly.Internal.Data.Stream.StreamK (IsStream())
@ -256,7 +256,7 @@ import Streamly.Internal.Data.Pipe.Types
-- import Streamly.Internal.Data.Strict -- import Streamly.Internal.Data.Strict
-- import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A -- import qualified Streamly.Internal.Data.Array.Foreign.Types as A
-- import qualified Streamly.Prelude as S -- import qualified Streamly.Prelude as S
-- import qualified Streamly.Internal.Data.Stream.StreamD as D -- import qualified Streamly.Internal.Data.Stream.StreamD as D
-- import qualified Streamly.Internal.Data.Stream.StreamK as K -- import qualified Streamly.Internal.Data.Stream.StreamK as K

View File

@ -103,7 +103,7 @@ foldr f z arr = runIdentity $ D.foldr f z $ toStreamD arr
-- 'SmallArray'. -- 'SmallArray'.
-- --
-- Since we are folding to a 'SmallArray' @n@ should be <= 128, for larger number -- Since we are folding to a 'SmallArray' @n@ should be <= 128, for larger number
-- of elements use an 'Array' from either "Streamly.Data.Array" or "Streamly.Data.Array.Storable.Foreign". -- of elements use an 'Array' from either "Streamly.Data.Array" 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 limit = Fold step initial extract writeN limit = Fold step initial extract
@ -139,7 +139,7 @@ fromStreamDN limit str = do
-- --
-- It is recommended to use a value of @n@ <= 128. For larger sized -- It is recommended to use a value of @n@ <= 128. For larger sized
-- arrays, use an 'Array' from "Streamly.Data.Array" or -- arrays, use an 'Array' from "Streamly.Data.Array" or
-- "Streamly.Data.Array.Storable.Foreign" -- "Streamly.Data.Array.Foreign"
{-# INLINABLE fromListN #-} {-# INLINABLE fromListN #-}
fromListN :: Int -> [a] -> SmallArray a fromListN :: Int -> [a] -> SmallArray a
fromListN n xs = unsafePerformIO $ fromStreamDN n $ D.fromList xs fromListN n xs = unsafePerformIO $ fromStreamDN n $ D.fromList xs

View File

@ -48,7 +48,7 @@ where
import Control.Concurrent (threadDelay) import Control.Concurrent (threadDelay)
import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.IO.Class (MonadIO(..))
import Foreign.Storable (Storable) import Foreign.Storable (Storable)
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array) import Streamly.Internal.Data.Array.Foreign.Types (Array)
import Streamly.Internal.Data.Fold.Types (Fold (..)) import Streamly.Internal.Data.Fold.Types (Fold (..))
import Streamly.Internal.Data.Stream.IsStream.Combinators (maxYields) import Streamly.Internal.Data.Stream.IsStream.Combinators (maxYields)
import Streamly.Internal.Data.Stream.Prelude (fromStreamS, toStreamS) import Streamly.Internal.Data.Stream.Prelude (fromStreamS, toStreamS)

View File

@ -162,7 +162,7 @@ import Streamly.Internal.Data.Stream.StreamD (fromStreamD, toStreamD)
import Streamly.Internal.Data.Stream.StreamK (IsStream) import Streamly.Internal.Data.Stream.StreamK (IsStream)
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Stream.Parallel as Par import qualified Streamly.Internal.Data.Stream.Parallel as Par
import qualified Streamly.Internal.Data.Stream.Prelude as P import qualified Streamly.Internal.Data.Stream.Prelude as P

View File

@ -254,7 +254,7 @@ import Foreign.Storable (Storable)
import Streamly.Internal.Data.Fold.Types (Fold (..), Fold2 (..)) import Streamly.Internal.Data.Fold.Types (Fold (..), Fold2 (..))
import Streamly.Internal.Data.Parser (Parser (..)) import Streamly.Internal.Data.Parser (Parser (..))
import Streamly.Internal.Data.Unfold.Types (Unfold) import Streamly.Internal.Data.Unfold.Types (Unfold)
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array) import Streamly.Internal.Data.Array.Foreign.Types (Array)
import Streamly.Internal.Data.SVar (MonadAsync) import Streamly.Internal.Data.SVar (MonadAsync)
import Streamly.Internal.Data.Stream.Ahead (ahead) import Streamly.Internal.Data.Stream.Ahead (ahead)
import Streamly.Internal.Data.Stream.Async (async, wAsync) import Streamly.Internal.Data.Stream.Async (async, wAsync)
@ -284,7 +284,7 @@ import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
import qualified Data.Heap as H import qualified Data.Heap as H
import qualified Data.Map.Strict as Map import qualified Data.Map.Strict as Map
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser.ParserK.Types as PRK import qualified Streamly.Internal.Data.Parser.ParserK.Types as PRK
import qualified Streamly.Internal.Data.Parser.ParserD as PRD import qualified Streamly.Internal.Data.Parser.ParserD as PRD

View File

@ -156,12 +156,12 @@ import Foreign.Storable (Storable(..))
import Fusion.Plugin.Types (Fuse(..)) import Fusion.Plugin.Types (Fuse(..))
import GHC.Types (SPEC(..)) import GHC.Types (SPEC(..))
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array(..)) import Streamly.Internal.Data.Array.Foreign.Types (Array(..))
import Streamly.Internal.Data.Fold.Types (Fold(..)) import Streamly.Internal.Data.Fold.Types (Fold(..))
import Streamly.Internal.Data.Parser (ParseError(..)) import Streamly.Internal.Data.Parser (ParseError(..))
import Streamly.Internal.Data.Unfold.Types (Unfold(..)) import Streamly.Internal.Data.Unfold.Types (Unfold(..))
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser as PR import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Internal.Data.Parser.ParserD as PRD import qualified Streamly.Internal.Data.Parser.ParserD as PRD

View File

@ -139,7 +139,7 @@ import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime)
import Streamly.Internal.Data.Time.Units import Streamly.Internal.Data.Time.Units
(TimeUnit64, toRelTime64, diffAbsTime64) (TimeUnit64, toRelTime64, diffAbsTime64)
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.IORef.Prim as Prim import qualified Streamly.Internal.Data.IORef.Prim as Prim
import qualified Streamly.Internal.Data.Pipe.Types as Pipe import qualified Streamly.Internal.Data.Pipe.Types as Pipe

View File

@ -64,7 +64,7 @@ import Prelude hiding (read)
-- import Streamly.Data.Fold (Fold) -- import Streamly.Data.Fold (Fold)
import Streamly.Internal.BaseCompat (fromLeft, fromRight) import Streamly.Internal.BaseCompat (fromLeft, fromRight)
import Streamly.Internal.Data.Unfold.Types (Unfold(..)) import Streamly.Internal.Data.Unfold.Types (Unfold(..))
-- import Streamly.Internal.Data.Array.Storable.Foreign.Types -- import Streamly.Internal.Data.Array.Foreign.Types
-- (Array(..), writeNUnsafe, defaultChunkSize, shrinkToFit, -- (Array(..), writeNUnsafe, defaultChunkSize, shrinkToFit,
-- lpackArraysChunksOf) -- lpackArraysChunksOf)
-- import Streamly.Internal.Data.Stream.Serial (SerialT) -- import Streamly.Internal.Data.Stream.Serial (SerialT)
@ -76,7 +76,7 @@ import Streamly.Internal.Data.Stream.StreamK.Type (IsStream)
import qualified Streamly.Internal.Data.Unfold as UF import qualified Streamly.Internal.Data.Unfold as UF
-- import qualified Streamly.Internal.Memory.ArrayStream as AS -- import qualified Streamly.Internal.Memory.ArrayStream as AS
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S
-- import qualified Streamly.Data.Array.Storable.Foreign as A -- import qualified Streamly.Data.Array.Foreign as A
-- import qualified Streamly.Internal.Data.Stream.StreamD.Type as D -- import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
import qualified System.Directory as Dir import qualified System.Directory as Dir
@ -166,9 +166,9 @@ toChunks = toChunksWithBufferOf defaultChunkSize
-- | Unfolds a handle into a stream of 'Word8' arrays. Requests to the IO -- | Unfolds a handle into a stream of 'Word8' arrays. Requests to the IO
-- device are performed using a buffer of size -- device are performed using a buffer of size
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. The -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'. The
-- size of arrays in the resulting stream are therefore less than or equal to -- size of arrays in the resulting stream are therefore less than or equal to
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'.
-- --
-- @since 0.7.0 -- @since 0.7.0
{-# INLINE readChunks #-} {-# INLINE readChunks #-}
@ -343,7 +343,7 @@ fromStreamWithBufferOf n h m = fromChunks h $ S.arraysOf n m
-- > write = 'writeWithBufferOf' A.defaultChunkSize -- > write = 'writeWithBufferOf' A.defaultChunkSize
-- --
-- | Write a byte stream to a file handle. Accumulates the input in chunks of -- | Write a byte stream to a file handle. Accumulates the input in chunks of
-- up to 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize' before writing. -- up to 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize' before writing.
-- --
-- NOTE: This may perform better than the 'write' fold, you can try this if you -- NOTE: This may perform better than the 'write' fold, you can try this if you
-- need some extra perf boost. -- need some extra perf boost.
@ -393,7 +393,7 @@ writeWithBufferOf n h = FL.chunksOf n (writeNUnsafe n) (writeChunks h)
-- > write = 'writeWithBufferOf' A.defaultChunkSize -- > write = 'writeWithBufferOf' A.defaultChunkSize
-- --
-- | Write a byte stream to a file handle. Accumulates the input in chunks of -- | Write a byte stream to a file handle. Accumulates the input in chunks of
-- up to 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize' before writing -- up to 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize' before writing
-- to the IO device. -- to the IO device.
-- --
-- @since 0.7.0 -- @since 0.7.0

View File

@ -165,7 +165,7 @@ import GHC.IO.Handle.FD (fdToHandle)
import Streamly.Prelude (SerialT) import Streamly.Prelude (SerialT)
import Streamly.Internal.Data.Cont (contListMap) import Streamly.Internal.Data.Cont (contListMap)
import Streamly.Internal.Data.Parser (Parser) import Streamly.Internal.Data.Parser (Parser)
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array(..)) import Streamly.Internal.Data.Array.Foreign.Types (Array(..))
import System.IO (Handle, hClose) import System.IO (Handle, hClose)
import qualified Data.List.NonEmpty as NonEmpty import qualified Data.List.NonEmpty as NonEmpty
@ -173,7 +173,7 @@ import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S
import qualified Streamly.Internal.Unicode.Stream as U import qualified Streamly.Internal.Unicode.Stream as U
import qualified Streamly.Internal.FileSystem.Handle as FH import qualified Streamly.Internal.FileSystem.Handle as FH
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Subscription to events -- Subscription to events

View File

@ -171,7 +171,7 @@ import GHC.IO.FD (fdFD, mkFD)
import GHC.IO.Handle.FD (mkHandleFromFD) import GHC.IO.Handle.FD (mkHandleFromFD)
import Streamly.Prelude (SerialT) import Streamly.Prelude (SerialT)
import Streamly.Internal.Data.Parser (Parser) import Streamly.Internal.Data.Parser (Parser)
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array(..)) import Streamly.Internal.Data.Array.Foreign.Types (Array(..))
import System.IO (Handle, hClose, IOMode(ReadMode)) import System.IO (Handle, hClose, IOMode(ReadMode))
#if !MIN_VERSION_base(4,10,0) #if !MIN_VERSION_base(4,10,0)
import Control.Concurrent.MVar (readMVar) import Control.Concurrent.MVar (readMVar)
@ -185,7 +185,7 @@ import GHC.IO.Handle.FD (handleToFd)
import qualified Data.IntMap.Lazy as Map import qualified Data.IntMap.Lazy as Map
import qualified Data.List.NonEmpty as NonEmpty import qualified Data.List.NonEmpty as NonEmpty
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser as PR import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S

View File

@ -124,8 +124,8 @@ import System.Win32.Types (BOOL, DWORD, HANDLE, LPVOID, LPDWORD, failIfFalse_)
import qualified Data.List.NonEmpty as NonEmpty import qualified Data.List.NonEmpty as NonEmpty
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S
import qualified Streamly.Internal.Unicode.Stream as U import qualified Streamly.Internal.Unicode.Stream as U
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import Streamly.Internal.Data.Array.Storable.Foreign (Array) import Streamly.Internal.Data.Array.Foreign (Array)
-- | Watch configuration, used to specify the events of interest and the -- | Watch configuration, used to specify the events of interest and the
-- behavior of the watch. -- behavior of the watch.

View File

@ -96,7 +96,7 @@ import qualified System.IO as SIO
import Streamly.Internal.Data.Fold.Types (Fold(..)) import Streamly.Internal.Data.Fold.Types (Fold(..))
import Streamly.Internal.Data.Unfold.Types (Unfold(..)) import Streamly.Internal.Data.Unfold.Types (Unfold(..))
import Streamly.Internal.Data.Array.Storable.Foreign.Types import Streamly.Internal.Data.Array.Foreign.Types
(Array(..), defaultChunkSize, writeNUnsafe) (Array(..), defaultChunkSize, writeNUnsafe)
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
import Streamly.Internal.Data.Stream.StreamK.Type (IsStream) import Streamly.Internal.Data.Stream.StreamK.Type (IsStream)
@ -108,7 +108,7 @@ import qualified Streamly.Internal.Data.Fold.Types as FL
import qualified Streamly.Internal.Data.Unfold as UF import qualified Streamly.Internal.Data.Unfold as UF
import qualified Streamly.Internal.FileSystem.Handle as FH import qualified Streamly.Internal.FileSystem.Handle as FH
import qualified Streamly.Internal.Memory.ArrayStream as AS import qualified Streamly.Internal.Memory.ArrayStream as AS
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -243,9 +243,9 @@ readChunksWithBufferOf = usingFile2 FH.readChunksWithBufferOf
-- | Unfolds a 'FilePath' into a stream of 'Word8' arrays. Requests to the IO -- | Unfolds a 'FilePath' into a stream of 'Word8' arrays. Requests to the IO
-- device are performed using a buffer of size -- device are performed using a buffer of size
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. The -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'. The
-- size of arrays in the resulting stream are therefore less than or equal to -- size of arrays in the resulting stream are therefore less than or equal to
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'.
-- --
-- /Internal/ -- /Internal/
{-# INLINE readChunks #-} {-# INLINE readChunks #-}
@ -262,7 +262,7 @@ readWithBufferOf = usingFile2 FH.readWithBufferOf
-- | Unfolds a file path into a byte stream. IO requests to the device are -- | Unfolds a file path into a byte stream. IO requests to the device are
-- performed in sizes of -- performed in sizes of
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'.
-- --
-- @since 0.7.0 -- @since 0.7.0
{-# INLINE read #-} {-# INLINE read #-}
@ -382,7 +382,7 @@ writeWithBufferOf n path =
-- > write = 'writeWithBufferOf' A.defaultChunkSize -- > write = 'writeWithBufferOf' A.defaultChunkSize
-- --
-- | Write a byte stream to a file. Accumulates the input in chunks of up to -- | Write a byte stream to a file. Accumulates the input in chunks of up to
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize' before writing to -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize' before writing to
-- the IO device. -- the IO device.
-- --
-- /Internal/ -- /Internal/

View File

@ -113,9 +113,9 @@ import Streamly.Prelude (MonadAsync)
import Streamly.Data.Fold (Fold) import Streamly.Data.Fold (Fold)
import Streamly.Internal.Data.Fold.Types (Fold2(..)) import Streamly.Internal.Data.Fold.Types (Fold2(..))
import Streamly.Internal.Data.Unfold.Types (Unfold(..)) import Streamly.Internal.Data.Unfold.Types (Unfold(..))
import Streamly.Internal.Data.Array.Storable.Foreign.Types import Streamly.Internal.Data.Array.Foreign.Types
(Array(..), writeNUnsafe, defaultChunkSize , unsafeFreezeWithShrink) (Array(..), writeNUnsafe, defaultChunkSize , unsafeFreezeWithShrink)
import Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types (mutableArray) import Streamly.Internal.Data.Array.Foreign.Mut.Types (mutableArray)
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
import Streamly.Internal.Data.Stream.StreamK.Type (IsStream, mkStream) import Streamly.Internal.Data.Stream.StreamK.Type (IsStream, mkStream)
import Streamly.Internal.Memory.ArrayStream (lpackArraysChunksOf) import Streamly.Internal.Memory.ArrayStream (lpackArraysChunksOf)
@ -124,10 +124,10 @@ import Streamly.Internal.Memory.ArrayStream (lpackArraysChunksOf)
import qualified Streamly.Data.Fold as FL import qualified Streamly.Data.Fold as FL
import qualified Streamly.Internal.Data.Fold.Types as FL import qualified Streamly.Internal.Data.Fold.Types as FL
import qualified Streamly.Internal.Data.Unfold as UF import qualified Streamly.Internal.Data.Unfold as UF
import qualified Streamly.Internal.Data.Array.Storable.Foreign as IA import qualified Streamly.Internal.Data.Array.Foreign as IA
import qualified Streamly.Internal.Memory.ArrayStream as AS import qualified Streamly.Internal.Memory.ArrayStream as AS
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Stream.StreamD.Type as D import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -255,9 +255,9 @@ getBytes = toBytes stdin
-- | Unfolds a handle into a stream of 'Word8' arrays. Requests to the IO -- | Unfolds a handle into a stream of 'Word8' arrays. Requests to the IO
-- device are performed using a buffer of size -- device are performed using a buffer of size
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. The -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'. The
-- size of arrays in the resulting stream are therefore less than or equal to -- size of arrays in the resulting stream are therefore less than or equal to
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'.
-- --
-- @since 0.7.0 -- @since 0.7.0
{-# INLINE readChunks #-} {-# INLINE readChunks #-}
@ -294,7 +294,7 @@ toBytesWithBufferOf chunkSize h = AS.concat $ toChunksWithBufferOf chunkSize h
-- --
-- | Unfolds a file handle into a byte stream. IO requests to the device are -- | Unfolds a file handle into a byte stream. IO requests to the device are
-- performed in sizes of -- performed in sizes of
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'.
-- --
-- @since 0.7.0 -- @since 0.7.0
{-# INLINE read #-} {-# INLINE read #-}
@ -411,7 +411,7 @@ fromBytesWithBufferOf n h m = fromChunks h $ S.arraysOf n m
-- > write = 'writeWithBufferOf' A.defaultChunkSize -- > write = 'writeWithBufferOf' A.defaultChunkSize
-- --
-- | Write a byte stream to a file handle. Accumulates the input in chunks of -- | Write a byte stream to a file handle. Accumulates the input in chunks of
-- up to 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize' before writing. -- up to 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize' before writing.
-- --
-- NOTE: This may perform better than the 'write' fold, you can try this if you -- NOTE: This may perform better than the 'write' fold, you can try this if you
-- need some extra perf boost. -- need some extra perf boost.
@ -469,7 +469,7 @@ writeWithBufferOf2 n = FL.chunksOf2 n (writeNUnsafe n) writeChunks2
-- > write = 'writeWithBufferOf' A.defaultChunkSize -- > write = 'writeWithBufferOf' A.defaultChunkSize
-- --
-- | Write a byte stream to a file handle. Accumulates the input in chunks of -- | Write a byte stream to a file handle. Accumulates the input in chunks of
-- up to 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize' before writing -- up to 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize' before writing
-- to the IO device. -- to the IO device.
-- --
-- @since 0.7.0 -- @since 0.7.0

View File

@ -52,15 +52,15 @@ import Prelude hiding (length, null, last, map, (!!), read, concat, unlines)
#if !defined(mingw32_HOST_OS) #if !defined(mingw32_HOST_OS)
import Streamly.FileSystem.FDIO (IOVec(..)) import Streamly.FileSystem.FDIO (IOVec(..))
#endif #endif
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array(..), length) import Streamly.Internal.Data.Array.Foreign.Types (Array(..), length)
import Streamly.Internal.Data.Fold.Types (Fold(..)) import Streamly.Internal.Data.Fold.Types (Fold(..))
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
import Streamly.Internal.Data.Stream.StreamK.Type (IsStream) import Streamly.Internal.Data.Stream.StreamK.Type (IsStream)
import Streamly.Internal.Data.SVar (adaptState) import Streamly.Internal.Data.SVar (adaptState)
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types as MA import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
import qualified Streamly.Internal.Data.Array.Stream.Mut.Foreign as AS import qualified Streamly.Internal.Data.Array.Stream.Mut.Foreign as AS
import qualified Streamly.Internal.Data.Fold.Types as FL import qualified Streamly.Internal.Data.Fold.Types as FL
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S

View File

@ -103,7 +103,7 @@ import Network.Socket
socket) socket)
import Prelude hiding (read) import Prelude hiding (read)
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array(..), defaultChunkSize, writeNUnsafe) import Streamly.Internal.Data.Array.Foreign.Types (Array(..), defaultChunkSize, writeNUnsafe)
import Streamly.Internal.Data.Fold.Types (Fold(..)) import Streamly.Internal.Data.Fold.Types (Fold(..))
import Streamly.Internal.Data.SVar (fork) import Streamly.Internal.Data.SVar (fork)
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
@ -117,7 +117,7 @@ import qualified Control.Monad.Catch as MC
import qualified Network.Socket as Net import qualified Network.Socket as Net
import qualified Streamly.Internal.Data.Unfold as UF import qualified Streamly.Internal.Data.Unfold as UF
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Memory.ArrayStream as AS import qualified Streamly.Internal.Memory.ArrayStream as AS
import qualified Streamly.Internal.Data.Fold.Types as FL import qualified Streamly.Internal.Data.Fold.Types as FL
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S

View File

@ -90,8 +90,8 @@ import qualified Network.Socket as Net
import Streamly.Prelude (MonadAsync) import Streamly.Prelude (MonadAsync)
import Streamly.Internal.Data.Unfold.Types (Unfold(..)) import Streamly.Internal.Data.Unfold.Types (Unfold(..))
import Streamly.Internal.Memory.ArrayStream (lpackArraysChunksOf) import Streamly.Internal.Memory.ArrayStream (lpackArraysChunksOf)
import Streamly.Internal.Data.Array.Storable.Foreign.Types (Array(..)) import Streamly.Internal.Data.Array.Foreign.Types (Array(..))
import Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types (mutableArray) import Streamly.Internal.Data.Array.Foreign.Mut.Types (mutableArray)
import Streamly.Internal.Data.Stream.Serial (SerialT) import Streamly.Internal.Data.Stream.Serial (SerialT)
import Streamly.Internal.Data.Stream.StreamK.Type (IsStream, mkStream) import Streamly.Internal.Data.Stream.StreamK.Type (IsStream, mkStream)
import Streamly.Data.Fold (Fold) import Streamly.Data.Fold (Fold)
@ -100,10 +100,10 @@ import Streamly.Data.Fold (Fold)
import qualified Streamly.Data.Fold as FL import qualified Streamly.Data.Fold as FL
import qualified Streamly.Internal.Data.Fold.Types as FL import qualified Streamly.Internal.Data.Fold.Types as FL
import qualified Streamly.Internal.Data.Unfold as UF import qualified Streamly.Internal.Data.Unfold as UF
import qualified Streamly.Internal.Data.Array.Storable.Foreign as IA import qualified Streamly.Internal.Data.Array.Foreign as IA
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Internal.Memory.ArrayStream as AS import qualified Streamly.Internal.Memory.ArrayStream as AS
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import qualified Streamly.Internal.Data.Stream.StreamD.Type as D import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
@ -381,9 +381,9 @@ readChunksWithBufferOf = Unfold step return
-- | Unfolds a socket into a stream of 'Word8' arrays. Requests to the socket -- | Unfolds a socket into a stream of 'Word8' arrays. Requests to the socket
-- are performed using a buffer of size -- are performed using a buffer of size
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. The -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'. The
-- size of arrays in the resulting stream are therefore less than or equal to -- size of arrays in the resulting stream are therefore less than or equal to
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'.
-- --
-- @since 0.7.0 -- @since 0.7.0
{-# INLINE readChunks #-} {-# INLINE readChunks #-}
@ -430,7 +430,7 @@ readWithBufferOf = UF.concat readChunksWithBufferOf A.read
-- | Unfolds a 'Socket' into a byte stream. IO requests to the socket are -- | Unfolds a 'Socket' into a byte stream. IO requests to the socket are
-- performed in sizes of -- performed in sizes of
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'.
-- --
-- @since 0.7.0 -- @since 0.7.0
{-# INLINE read #-} {-# INLINE read #-}

View File

@ -20,11 +20,11 @@ where
import Control.Monad.IO.Class (MonadIO) import Control.Monad.IO.Class (MonadIO)
import Streamly.Prelude (MonadAsync) import Streamly.Prelude (MonadAsync)
import Prelude hiding (String, lines, words, unlines, unwords) import Prelude hiding (String, lines, words, unlines, unwords)
import Streamly.Data.Array.Storable.Foreign (Array) import Streamly.Data.Array.Foreign (Array)
import Streamly.Internal.Data.Stream.IsStream (IsStream) import Streamly.Internal.Data.Stream.IsStream (IsStream)
import qualified Streamly.Internal.Unicode.Stream as S import qualified Streamly.Internal.Unicode.Stream as S
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
-- | Break a string up into a stream of strings at newline characters. -- | Break a string up into a stream of strings at newline characters.
-- The resulting strings do not contain newlines. -- The resulting strings do not contain newlines.

View File

@ -81,14 +81,14 @@ import GHC.IO.Encoding.Failure (isSurrogate)
import GHC.Ptr (Ptr (..), plusPtr) import GHC.Ptr (Ptr (..), plusPtr)
import System.IO.Unsafe (unsafePerformIO) import System.IO.Unsafe (unsafePerformIO)
import Streamly.Data.Fold (Fold) import Streamly.Data.Fold (Fold)
import Streamly.Data.Array.Storable.Foreign (Array) import Streamly.Data.Array.Foreign (Array)
import Streamly.Internal.Data.Unfold (Unfold) import Streamly.Internal.Data.Unfold (Unfold)
import Streamly.Internal.Data.SVar (adaptState) import Streamly.Internal.Data.SVar (adaptState)
import Streamly.Internal.Data.Stream.IsStream (IsStream) import Streamly.Internal.Data.Stream.IsStream (IsStream)
import Streamly.Internal.Data.Stream.StreamD (Stream(..), Step (..)) import Streamly.Internal.Data.Stream.StreamD (Stream(..), Step (..))
import Streamly.Internal.Data.Tuple.Strict (Tuple'(..)) import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S
import qualified Streamly.Internal.Data.Stream.StreamD as D import qualified Streamly.Internal.Data.Stream.StreamD as D

View File

@ -32,10 +32,10 @@
-- --
-- > import qualified Streamly.Array as A -- > import qualified Streamly.Array as A
-- --
-- For experimental APIs see "Streamly.Internal.Data.Array.Storable.Foreign". -- For experimental APIs see "Streamly.Internal.Data.Array.Foreign".
module Streamly.Memory.Array module Streamly.Memory.Array
{-# DEPRECATED "Use Streamly.Data.Array.Storable.Foreign instead" #-} {-# DEPRECATED "Use Streamly.Data.Array.Foreign instead" #-}
( (
A.Array A.Array
@ -71,4 +71,4 @@ module Streamly.Memory.Array
) )
where where
import Streamly.Internal.Data.Array.Storable.Foreign as A import Streamly.Internal.Data.Array.Foreign as A

View File

@ -41,7 +41,7 @@ import Prelude hiding (length, concat)
import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.IO.Class (MonadIO(..))
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
-- | A ring buffer is a mutable array of fixed size. Initially the array is -- | A ring buffer is a mutable array of fixed size. Initially the array is
-- empty, with ringStart pointing at the start of allocated memory. We call the -- empty, with ringStart pointing at the start of allocated memory. We call the

View File

@ -64,9 +64,9 @@
-- = Programmer Notes -- = Programmer Notes
-- --
-- Read IO requests to connected stream sockets are performed in chunks of -- Read IO requests to connected stream sockets are performed in chunks of
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize'. Unless specified -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize'. Unless specified
-- otherwise in the API, writes are collected into chunks of -- otherwise in the API, writes are collected into chunks of
-- 'Streamly.Internal.Data.Array.Storable.Foreign.Types.defaultChunkSize' before they are -- 'Streamly.Internal.Data.Array.Foreign.Types.defaultChunkSize' before they are
-- written to the socket. APIs are provided to control the chunking behavior. -- written to the socket. APIs are provided to control the chunking behavior.
-- --
-- > import qualified Streamly.Network.Socket as SK -- > import qualified Streamly.Network.Socket as SK
@ -89,7 +89,7 @@
-- APIs for unconnected sockets need to explicitly specify the remote endpoint. -- APIs for unconnected sockets need to explicitly specify the remote endpoint.
-- --
-- By design, connected socket IO APIs are similar to -- By design, connected socket IO APIs are similar to
-- "Streamly.Data.Array.Storable.Foreign" read write APIs. They are almost identical to the -- "Streamly.Data.Array.Foreign" read write APIs. They are almost identical to the
-- sequential streaming APIs in "Streamly.Internal.FileSystem.File". -- sequential streaming APIs in "Streamly.Internal.FileSystem.File".
-- --
module Streamly.Network.Socket module Streamly.Network.Socket

View File

@ -12,11 +12,11 @@
-- A 'Char' stream is the canonical representation to process Unicode strings. -- A 'Char' stream is the canonical representation to process Unicode strings.
-- It can be processed efficiently using regular stream processing operations. -- It can be processed efficiently using regular stream processing operations.
-- A byte stream of Unicode text read from an IO device or from an -- A byte stream of Unicode text read from an IO device or from an
-- 'Streamly.Data.Array.Storable.Foreign.Array' in memory can be decoded into a 'Char' stream -- 'Streamly.Data.Array.Foreign.Array' in memory can be decoded into a 'Char' stream
-- using the decoding routines in this module. A 'String' (@[Char]@) can be -- using the decoding routines in this module. A 'String' (@[Char]@) can be
-- converted into a 'Char' stream using 'Streamly.Prelude.fromList'. An @Array -- converted into a 'Char' stream using 'Streamly.Prelude.fromList'. An @Array
-- Char@ can be 'Streamly.Prelude.unfold'ed into a stream using the array -- Char@ can be 'Streamly.Prelude.unfold'ed into a stream using the array
-- 'Streamly.Data.Array.Storable.Foreign.read' unfold. -- 'Streamly.Data.Array.Foreign.read' unfold.
-- --
-- = Storing Unicode Strings -- = Storing Unicode Strings
-- --
@ -30,7 +30,7 @@
-- than pinned arrays for short and short lived strings. -- than pinned arrays for short and short lived strings.
-- --
-- For longer or long lived streams you can 'Streamly.Prelude.fold' the 'Char' -- For longer or long lived streams you can 'Streamly.Prelude.fold' the 'Char'
-- stream as @Array Char@ using the array 'Streamly.Data.Array.Storable.Foreign.write' fold. -- stream as @Array Char@ using the array 'Streamly.Data.Array.Foreign.write' fold.
-- The 'Array' type provides a more compact representation and pinned memory -- The 'Array' type provides a more compact representation and pinned memory
-- reducing GC overhead. If space efficiency is a concern you can use -- reducing GC overhead. If space efficiency is a concern you can use
-- 'encodeUtf8'' on the 'Char' stream before writing it to an 'Array' providing -- 'encodeUtf8'' on the 'Char' stream before writing it to an 'Array' providing

View File

@ -166,7 +166,7 @@ extra-source-files:
test/Streamly/Test/Data/*.hs test/Streamly/Test/Data/*.hs
test/Streamly/Test/Data/Array/Prim.hs test/Streamly/Test/Data/Array/Prim.hs
test/Streamly/Test/Data/Array/Prim/Pinned.hs test/Streamly/Test/Data/Array/Prim/Pinned.hs
test/Streamly/Test/Data/Array/Storable/Foreign.hs test/Streamly/Test/Data/Array/Foreign.hs
test/Streamly/Test/Data/Parser/ParserD.hs test/Streamly/Test/Data/Parser/ParserD.hs
test/Streamly/Test/FileSystem/Event.hs test/Streamly/Test/FileSystem/Event.hs
test/Streamly/Test/FileSystem/Handle.hs test/Streamly/Test/FileSystem/Handle.hs
@ -388,7 +388,7 @@ library
Streamly.Prelude Streamly.Prelude
, Streamly.Data.Unfold , Streamly.Data.Unfold
, Streamly.Data.Fold , Streamly.Data.Fold
, Streamly.Data.Array.Storable.Foreign , Streamly.Data.Array.Foreign
-- Text Processing -- Text Processing
, Streamly.Unicode.Stream , Streamly.Unicode.Stream
@ -444,8 +444,8 @@ library
-- streamly-core-array -- streamly-core-array
-- May depend on streamly-core-stream -- May depend on streamly-core-stream
, Streamly.Internal.Data.Array.Storable.Foreign.Mut.Types , Streamly.Internal.Data.Array.Foreign.Mut.Types
, Streamly.Internal.Data.Array.Storable.Foreign.Types , Streamly.Internal.Data.Array.Foreign.Types
, Streamly.Internal.Data.Array.Prim.Mut.Types , Streamly.Internal.Data.Array.Prim.Mut.Types
, Streamly.Internal.Data.Array.Prim.Types , Streamly.Internal.Data.Array.Prim.Types
, Streamly.Internal.Data.Array.Prim.Pinned.Mut.Types , Streamly.Internal.Data.Array.Prim.Pinned.Mut.Types
@ -498,7 +498,7 @@ library
-- streamly-arrays -- streamly-arrays
-- May depend on streamly-core -- May depend on streamly-core
, Streamly.Internal.Data.Array , Streamly.Internal.Data.Array
, Streamly.Internal.Data.Array.Storable.Foreign , Streamly.Internal.Data.Array.Foreign
, Streamly.Internal.Data.Array.Prim , Streamly.Internal.Data.Array.Prim
, Streamly.Internal.Data.Array.Prim.Pinned , Streamly.Internal.Data.Array.Prim.Pinned
, Streamly.Internal.Data.SmallArray , Streamly.Internal.Data.SmallArray

View File

@ -28,8 +28,8 @@ type Array = A.SmallArray
#elif defined(TEST_ARRAY) #elif defined(TEST_ARRAY)
import Data.Word(Word8) import Data.Word(Word8)
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as A import qualified Streamly.Internal.Data.Array.Foreign.Types as A
import qualified Streamly.Internal.Data.Stream.IsStream as IP import qualified Streamly.Internal.Data.Stream.IsStream as IP
import qualified Streamly.Internal.Memory.ArrayStream as AS import qualified Streamly.Internal.Memory.ArrayStream as AS
type Array = A.Array type Array = A.Array

View File

@ -1,12 +1,12 @@
-- | -- |
-- Module : Streamly.Test.Data.Array.Storable.Foreign -- Module : Streamly.Test.Data.Array.Foreign
-- Copyright : (c) 2019 Composewell technologies -- Copyright : (c) 2019 Composewell technologies
-- License : BSD-3-Clause -- License : BSD-3-Clause
-- Maintainer : streamly@composewell.com -- Maintainer : streamly@composewell.com
-- Stability : experimental -- Stability : experimental
-- Portability : GHC -- Portability : GHC
module Streamly.Test.Data.Array.Storable.Foreign (main) where module Streamly.Test.Data.Array.Foreign (main) where
#define TEST_ARRAY #define TEST_ARRAY
#include "Streamly/Test/Common/Array.hs" #include "Streamly/Test/Common/Array.hs"

View File

@ -14,7 +14,7 @@ import Prelude hiding (sequence)
import qualified Data.List as List import qualified Data.List as List
import qualified Prelude import qualified Prelude
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser as P import qualified Streamly.Internal.Data.Parser as P
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S

View File

@ -12,7 +12,7 @@ import Test.QuickCheck.Monadic (monadicIO, assert, run)
import qualified Data.List as List import qualified Data.List as List
import qualified Prelude import qualified Prelude
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A import qualified Streamly.Internal.Data.Array.Foreign as A
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser.ParserD as P import qualified Streamly.Internal.Data.Parser.ParserD as P
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S

View File

@ -29,12 +29,12 @@ import System.IO.Temp (withSystemTempDirectory)
#if !defined(CABAL_OS_WINDOWS) #if !defined(CABAL_OS_WINDOWS)
import System.IO.Unsafe (unsafePerformIO) import System.IO.Unsafe (unsafePerformIO)
#endif #endif
import Streamly.Internal.Data.Array.Storable.Foreign (Array) import Streamly.Internal.Data.Array.Foreign (Array)
import qualified Data.List.NonEmpty as NonEmpty import qualified Data.List.NonEmpty as NonEmpty
import qualified Data.Set as Set import qualified Data.Set as Set
import qualified Streamly.Unicode.Stream as Unicode import qualified Streamly.Unicode.Stream as Unicode
import qualified Streamly.Internal.Data.Array.Storable.Foreign as Array import qualified Streamly.Internal.Data.Array.Foreign as Array
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser as PR import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Internal.Data.Stream.IsStream as S import qualified Streamly.Internal.Data.Stream.IsStream as S

View File

@ -29,7 +29,7 @@ import Test.QuickCheck.Monadic (monadicIO, assert, run)
import qualified Streamly.Data.Fold as Fold import qualified Streamly.Data.Fold as Fold
import qualified Streamly.FileSystem.Handle as Handle import qualified Streamly.FileSystem.Handle as Handle
import qualified Streamly.Internal.Data.Stream.IsStream as Stream import qualified Streamly.Internal.Data.Stream.IsStream as Stream
import qualified Streamly.Internal.Data.Array.Storable.Foreign as Array import qualified Streamly.Internal.Data.Array.Foreign as Array
import qualified Streamly.Internal.Unicode.Stream as Unicode import qualified Streamly.Internal.Unicode.Stream as Unicode
import Test.Hspec as H import Test.Hspec as H

View File

@ -19,7 +19,7 @@ import Streamly.Prelude (SerialT)
import Test.QuickCheck (Property) import Test.QuickCheck (Property)
import Test.QuickCheck.Monadic (monadicIO, assert, run) import Test.QuickCheck.Monadic (monadicIO, assert, run)
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as Array import qualified Streamly.Internal.Data.Array.Foreign.Types as Array
import qualified Streamly.Internal.Data.Unfold as Unfold import qualified Streamly.Internal.Data.Unfold as Unfold
import qualified Streamly.Internal.Network.Inet.TCP as TCP import qualified Streamly.Internal.Network.Inet.TCP as TCP
import qualified Streamly.Internal.Network.Socket as Socket import qualified Streamly.Internal.Network.Socket as Socket

View File

@ -19,7 +19,7 @@ import Streamly.Prelude (SerialT)
import Test.QuickCheck (Property) import Test.QuickCheck (Property)
import Test.QuickCheck.Monadic (monadicIO, assert, run) import Test.QuickCheck.Monadic (monadicIO, assert, run)
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as Array import qualified Streamly.Internal.Data.Array.Foreign.Types as Array
import qualified Streamly.Internal.Network.Inet.TCP as TCP import qualified Streamly.Internal.Network.Inet.TCP as TCP
import qualified Streamly.Internal.Network.Socket as Socket import qualified Streamly.Internal.Network.Socket as Socket
import qualified Streamly.Internal.Unicode.Stream as Unicode import qualified Streamly.Internal.Unicode.Stream as Unicode

View File

@ -46,7 +46,7 @@ import qualified Streamly.Prelude as S
import qualified Streamly.Data.Fold as FL import qualified Streamly.Data.Fold as FL
import qualified Streamly.Internal.Data.Unfold as UF import qualified Streamly.Internal.Data.Unfold as UF
import qualified Streamly.Internal.Data.Stream.IsStream as IS import qualified Streamly.Internal.Data.Stream.IsStream as IS
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import Streamly.Internal.Data.Time.Units import Streamly.Internal.Data.Time.Units
(AbsTime, NanoSecond64(..), toRelTime64, diffAbsTime64) (AbsTime, NanoSecond64(..), toRelTime64, diffAbsTime64)

View File

@ -16,7 +16,7 @@ import Test.QuickCheck
) )
import Test.QuickCheck.Monadic (run, monadicIO, assert) import Test.QuickCheck.Monadic (run, monadicIO, assert)
import qualified Streamly.Data.Array.Storable.Foreign as A import qualified Streamly.Data.Array.Foreign as A
import qualified Streamly.Internal.Memory.ArrayStream as AS import qualified Streamly.Internal.Memory.ArrayStream as AS
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import qualified Streamly.Unicode.Stream as SS import qualified Streamly.Unicode.Stream as SS

View File

@ -207,11 +207,11 @@ test-suite Data.Array.Prim.Pinned
main-is: Streamly/Test/Data/Array/Prim/Pinned.hs main-is: Streamly/Test/Data/Array/Prim/Pinned.hs
ghc-options: -main-is Streamly.Test.Data.Array.Prim.Pinned.main ghc-options: -main-is Streamly.Test.Data.Array.Prim.Pinned.main
test-suite Data.Array.Storable.Foreign test-suite Data.Array.Foreign
import: test-options import: test-options
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: Streamly/Test/Data/Array/Storable/Foreign.hs main-is: Streamly/Test/Data/Array/Foreign.hs
ghc-options: -main-is Streamly.Test.Data.Array.Storable.Foreign.main ghc-options: -main-is Streamly.Test.Data.Array.Foreign.main
test-suite Data.Fold test-suite Data.Fold
import: test-options import: test-options