on master help sign in
Make minor change to array module docs
ba0d42aHarendra Kumar
core/src/Streamly/Data/Array.hs+10−4
@@ -9,7 +9,13 @@
9--
9--
10-- This module provides APIs to create and use unboxed immutable arrays. Once
10-- This module provides APIs to create and use unboxed immutable arrays. Once
11-- created, their contents cannot be modified. Only types that are unboxable
11-- created, their contents cannot be modified. Only types that are unboxable
12−-- via the 'Unbox' type class can be stored in these arrays.
12+-- via the 'Unbox' type class can be stored in these arrays. Note that the
13+-- array memory grows automatically when creating a new array, therefore, an
14+-- array can be created from a variable length stream.
15+--
16+-- See "Streamly.Data.Array.Generic" for arrays that work for boxed types i.e.
17+-- not requiring the 'Unbox' constraint.
18+-- See "Streamly.Data.MutArray" for arrays that can be mutated in-place..
13--
19--
14-- = Folding Arrays
20-- = Folding Arrays
15--
21--
@@ -55,6 +61,9 @@
55-- >>> Stream.fold (purely Array.write) $ Stream.fromList [1,2,3::Int]
61-- >>> Stream.fold (purely Array.write) $ Stream.fromList [1,2,3::Int]
56-- Identity fromList [1,2,3]
62-- Identity fromList [1,2,3]
57--
63--
64+-- Since it is a pure stream we can use 'unsafePerformIO' to extract the result
65+-- of fold from IO.
66+--
58-- Alternatively, 'Identity' streams can be generalized to IO streams:
67-- Alternatively, 'Identity' streams can be generalized to IO streams:
59--
68--
60-- >>> pure = Stream.fromList [1,2,3] :: Stream Identity Int
69-- >>> pure = Stream.fromList [1,2,3] :: Stream Identity Int
@@ -62,9 +71,6 @@
62-- >>> Stream.fold Array.write (generally pure :: Stream IO Int)
71-- >>> Stream.fold Array.write (generally pure :: Stream IO Int)
63-- fromList [1,2,3]
72-- fromList [1,2,3]
64--
73--
65−-- Since it is a pure stream we can use 'unsafePerformIO' to extract the result
66−-- of fold from IO.
67−--
68-- = Programming Tips
74-- = Programming Tips
69--
75--
70-- This module is designed to be imported qualified:
76-- This module is designed to be imported qualified:
core/src/Streamly/Data/MutArray.hs+5−2
@@ -7,9 +7,12 @@
7-- Stability : released
7-- Stability : released
8-- Portability : GHC
8-- Portability : GHC
9--
9--
10−-- This module provides mutable arrays suitable for long lived data storage,
10+-- Mutable version of "Streamly.Data.Array". Please refer to that module for
11−-- random access, and mutation.
11+-- general documentation. The contents of mutable ararys can be modified
12+-- in-place.
12--
13--
14+-- See "Streamly.Data.MutArray.Generic" for mutable arrays that work for boxed
15+-- types i.e. not requiring the 'Unbox' constraint.
13
16
14module Streamly.Data.MutArray
17module Streamly.Data.MutArray
15 (
18 (
core/src/Streamly/Data/MutArray/Generic.hs+3−1
@@ -6,7 +6,9 @@
6-- Stability : experimental
6-- Stability : experimental
7-- Portability : GHC
7-- Portability : GHC
8--
8--
9+-- Unconstrained version of "Streamly.Data.MutArray" module.
10+--
9−-- Mutable variant of the "Streamly.Data.Array.Generic" module.
11+-- See the "Streamly.Data.MutArray" module for documentation.
10--
12--
11module Streamly.Data.MutArray.Generic
13module Streamly.Data.MutArray.Generic
12(
14(