2-- Module : Streamly.Data.MutByteArray
3-- Copyright : (c) 2023 Composewell Technologies
4-- License : BSD3-3-Clause
5-- Maintainer : streamly@composewell.com
8-- A low level byte Array type for fast binary serialization and
9-- deserialization of Haskell values. Higher level unboxed array modules
10-- "Streamly.Data.Array" and "Streamly.Data.MutArray" are built on top of this
11-- module. This module provides two type classes for serialization, 'Unbox' and
12-- 'Serialize'. The speed is similar to, and in some cases many times faster
13-- than the store package. Conceptually, the 'Serialize' type class works in
14-- the same way as store.
16-- You probably want the higher level
17-- 'Streamly.Internal.Data.Array.pinnedSerialize' and
18-- 'Streamly.Internal.Data.Array.deserialize' from the "Streamly.Data.Array"
21-- == Mutable Byte Array
23-- 'MutByteArray' is a primitive mutable array in the IO monad. 'Unbox' and
24-- 'Serialize' type classes use this primitive array to serialize data to and
25-- deserialize it from. This array is used to build higher level unboxed
26-- array types 'Streamly.Data.MutArray.MutArray' and 'Streamly.Data.Array.Array'.
30-- The 'Unbox' type class is simple and used to serialize non-recursive fixed
31-- size data types. This type class is primarily used to implement unboxed
32-- arrays. Unboxed arrays are just a sequence of serialized fixed length
33-- Haskell data types. Instances of this type class can be derived using
34-- 'Generic' or template haskell based deriving functions provided in this
37-- Writing a data type to an array using the array creation routines in
38-- "Streamly.Data.Array" or "Streamly.Data.MutArray" (e.g. @writeN@ or
39-- @fromListN@), serializes the type to the array. Similarly, reading the data
40-- type from the array deserializes it. You can also serialize and deserialize
41-- directly to and from a 'MutByteArray', using the type class methods.
45-- The 'Serialize' type class is a superset of the 'Unbox' type class, it can
46-- serialize variable length data types as well e.g. Haskell lists. Use
47-- 'deriveSerialize' to derive the instances of the type class automatically
48-- and then use the type class methods to serialize and deserialize to and from
51-- See 'Streamly.Internal.Data.Array.pinnedSerialize' and
52-- 'Streamly.Internal.Data.Array.deserialize' for 'Array' type based
55module Streamly.Data.MutByteArray
58 -- * Mutable Byte Array
59 -- | The standard way to read from or write to a 'MutByteArray' is by using
60 -- the 'Unbox' or 'Serialize' type class methods.
86--------------------------------------------------------------------------------
88--------------------------------------------------------------------------------
90import Streamly.Internal.Data.MutByteArray
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list