diff --git a/core/src/Streamly/Data/Array.hs b/core/src/Streamly/Data/Array.hs index 247bf9227..476976e30 100644 --- a/core/src/Streamly/Data/Array.hs +++ b/core/src/Streamly/Data/Array.hs @@ -9,7 +9,13 @@ -- -- This module provides APIs to create and use unboxed immutable arrays. Once -- created, their contents cannot be modified. Only types that are unboxable --- via the 'Unbox' type class can be stored in these arrays. +-- via the 'Unbox' type class can be stored in these arrays. Note that the +-- array memory grows automatically when creating a new array, therefore, an +-- array can be created from a variable length stream. +-- +-- See "Streamly.Data.Array.Generic" for arrays that work for boxed types i.e. +-- not requiring the 'Unbox' constraint. +-- See "Streamly.Data.MutArray" for arrays that can be mutated in-place.. -- -- = Folding Arrays -- @@ -55,6 +61,9 @@ -- >>> Stream.fold (purely Array.write) $ Stream.fromList [1,2,3::Int] -- Identity fromList [1,2,3] -- +-- Since it is a pure stream we can use 'unsafePerformIO' to extract the result +-- of fold from IO. +-- -- Alternatively, 'Identity' streams can be generalized to IO streams: -- -- >>> pure = Stream.fromList [1,2,3] :: Stream Identity Int @@ -62,9 +71,6 @@ -- >>> Stream.fold Array.write (generally pure :: Stream IO Int) -- fromList [1,2,3] -- --- Since it is a pure stream we can use 'unsafePerformIO' to extract the result --- of fold from IO. --- -- = Programming Tips -- -- This module is designed to be imported qualified: diff --git a/core/src/Streamly/Data/MutArray.hs b/core/src/Streamly/Data/MutArray.hs index 4318fc33a..db147a32e 100644 --- a/core/src/Streamly/Data/MutArray.hs +++ b/core/src/Streamly/Data/MutArray.hs @@ -7,9 +7,12 @@ -- Stability : released -- Portability : GHC -- --- This module provides mutable arrays suitable for long lived data storage, --- random access, and mutation. +-- Mutable version of "Streamly.Data.Array". Please refer to that module for +-- general documentation. The contents of mutable ararys can be modified +-- in-place. -- +-- See "Streamly.Data.MutArray.Generic" for mutable arrays that work for boxed +-- types i.e. not requiring the 'Unbox' constraint. module Streamly.Data.MutArray ( diff --git a/core/src/Streamly/Data/MutArray/Generic.hs b/core/src/Streamly/Data/MutArray/Generic.hs index e7e621481..ac48560a6 100644 --- a/core/src/Streamly/Data/MutArray/Generic.hs +++ b/core/src/Streamly/Data/MutArray/Generic.hs @@ -6,7 +6,9 @@ -- Stability : experimental -- Portability : GHC -- --- Mutable variant of the "Streamly.Data.Array.Generic" module. +-- Unconstrained version of "Streamly.Data.MutArray" module. +-- +-- See the "Streamly.Data.MutArray" module for documentation. -- module Streamly.Data.MutArray.Generic (