-
Notifications
You must be signed in to change notification settings - Fork 141
/
Internal.hs
96 lines (81 loc) · 2.6 KB
/
Internal.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{-# OPTIONS_HADDOCK not-home #-}
-- |
-- Module : Data.ByteString.Internal
-- Copyright : (c) Don Stewart 2006-2008
-- (c) Duncan Coutts 2006-2012
-- License : BSD-style
-- Maintainer : [email protected], [email protected]
-- Stability : unstable
-- Portability : non-portable
--
-- A module containing semi-public 'ByteString' internals. This exposes the
-- 'ByteString' representation and low level construction functions. As such
-- all the functions in this module are unsafe. The API is also not stable.
--
-- Where possible application should instead use the functions from the normal
-- public interface modules, such as "Data.ByteString.Unsafe". Packages that
-- extend the ByteString system at a low level will need to use this module.
--
module Data.ByteString.Internal (
-- * The @ByteString@ type and representation
ByteString
( BS
, PS -- backwards compatibility shim
),
StrictByteString,
-- * Internal indexing
findIndexOrLength,
-- * Conversion with lists: packing and unpacking
packBytes, packUptoLenBytes, unsafePackLenBytes,
packChars, packUptoLenChars, unsafePackLenChars,
unpackBytes, unpackAppendBytesLazy, unpackAppendBytesStrict,
unpackChars, unpackAppendCharsLazy, unpackAppendCharsStrict,
unsafePackAddress, unsafePackLenAddress,
unsafePackLiteral, unsafePackLenLiteral,
-- * Low level imperative construction
empty,
create,
createUptoN,
createUptoN',
createAndTrim,
createAndTrim',
unsafeCreate,
unsafeCreateUptoN,
unsafeCreateUptoN',
mallocByteString,
-- * Conversion to and from ForeignPtrs
mkDeferredByteString,
fromForeignPtr,
toForeignPtr,
fromForeignPtr0,
toForeignPtr0,
-- * Utilities
nullForeignPtr,
deferForeignPtrAvailability,
SizeOverflowException,
overflowError,
checkedAdd,
checkedMultiply,
-- * Standard C Functions
c_strlen,
c_free_finalizer,
memchr,
memcmp,
memcpy,
memset,
-- * cbits functions
c_reverse,
c_intersperse,
c_maximum,
c_minimum,
c_count,
c_sort,
-- * Chars
w2c, c2w, isSpaceWord8, isSpaceChar8,
-- * Deprecated and unmentionable
accursedUnutterablePerformIO,
-- * Exported compatibility shim
plusForeignPtr,
unsafeWithForeignPtr
) where
import Data.ByteString.Internal.Type