Skip to content

Commit 67c9fcd

Browse files
committed
Add module level documentation for Unsafe modules
1 parent 22b4fb3 commit 67c9fcd

10 files changed

Lines changed: 59 additions & 5 deletions

File tree

vector/src/Data/Vector.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
-- Stability : experimental
1717
-- Portability : non-portable
1818
--
19-
-- A library for boxed vectors (that is, polymorphic arrays capable of
19+
-- A library for lazy boxed vectors (that is, polymorphic arrays capable of
2020
-- holding any Haskell value). The vectors come in two flavours:
2121
--
2222
-- * mutable

vector/src/Data/Vector/Mutable/Unsafe.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
{-# LANGUAGE RoleAnnotations #-}
66
{-# LANGUAGE TypeFamilies #-}
77
-- |
8+
-- This module exposes internal representation of mutable lazy boxed
9+
-- vector and functions that work on that representation directly (as
10+
-- opposed to using 'G.MVector' API.
11+
--
12+
-- Note that working with internal representation of vector is
13+
-- generally unsafe and may violate memory safety
814
module Data.Vector.Mutable.Unsafe
915
( MVector(..)
1016
, IOVector

vector/src/Data/Vector/Primitive/Mutable/Unsafe.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
{-# LANGUAGE RoleAnnotations #-}
66
{-# LANGUAGE ScopedTypeVariables #-}
77
-- |
8+
-- This module exposes internal representation of mutable vectors backed by
9+
-- single 'ByteArray' and functions that work on that representation
10+
-- directly (as opposed to using 'G.Vector' API).
11+
--
12+
-- Note that working with internal representation of vector is
13+
-- generally unsafe and may violate memory safety.
814
module Data.Vector.Primitive.Mutable.Unsafe
915
( MVector(..)
1016
, IOVector

vector/src/Data/Vector/Primitive/Unsafe.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
{-# LANGUAGE RoleAnnotations #-}
66
{-# LANGUAGE ScopedTypeVariables #-}
77
-- |
8+
-- This module exposes internal representation of vectors backed by
9+
-- single 'ByteArray' and functions that work on that representation
10+
-- directly (as opposed to using 'G.Vector' API).
11+
--
12+
-- Note that working with internal representation of vector is
13+
-- generally unsafe and may violate memory safety.
814
module Data.Vector.Primitive.Unsafe
915
( -- * Mutable vector
1016
Vector(..)

vector/src/Data/Vector/Storable/Mutable/Unsafe.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
{-# LANGUAGE RoleAnnotations #-}
66
{-# LANGUAGE ScopedTypeVariables #-}
77
-- |
8+
-- This module exposes internal representation of mutable vectors
9+
-- based on 'Storable' and functions that work on that representation
10+
-- directly (as opposed to using 'G.Vector' API.
11+
--
12+
-- Note that working with internal representation of vector is
13+
-- generally unsafe and may violate memory safety.
814
module Data.Vector.Storable.Mutable.Unsafe
915
( MVector(..)
1016
, IOVector

vector/src/Data/Vector/Storable/Unsafe.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
{-# LANGUAGE ScopedTypeVariables #-}
77
{-# LANGUAGE TypeFamilies #-}
88
-- |
9+
-- This module exposes internal representation of vectors based on
10+
-- 'Storable' and functions that work on that representation directly
11+
-- (as opposed to using 'G.Vector' API.
12+
--
13+
-- Note that working with internal representation of vector is
14+
-- generally unsafe and may violate memory safety.
915
module Data.Vector.Storable.Unsafe
1016
( Vector(..)
1117
, unsafeCoerceVector

vector/src/Data/Vector/Strict/Mutable/Unsafe.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
{-# LANGUAGE TypeApplications #-}
88
{-# LANGUAGE ScopedTypeVariables #-}
99
-- |
10+
-- This module exposes internal representation of mutable strict boxed
11+
-- vector and functions that work on that representation directly (as
12+
-- opposed to using 'G.MVector' API.
13+
--
14+
-- Note that working with internal representation of vector is
15+
-- generally unsafe and may violate memory safety
1016
module Data.Vector.Strict.Mutable.Unsafe
1117
( MVector(..)
1218
, IOVector

vector/src/Data/Vector/Strict/Unsafe.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
{-# LANGUAGE ScopedTypeVariables #-}
99
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1010
-- |
11+
-- This module exposes internal representation of strict boxed vector
12+
-- and functions that work on that representation directly (as opposed
13+
-- to using 'G.Vector' API.
14+
--
15+
-- Note that working with internal representation of vector is
16+
-- generally unsafe and may violate memory safety
1117
module Data.Vector.Strict.Unsafe
1218
( Vector(..)
1319
-- * Vector conversions

vector/src/Data/Vector/Unboxed/Unsafe.hs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{-# LANGUAGE TypeApplications #-}
1313
{-# LANGUAGE DerivingVia #-}
1414
-- |
15-
-- Module : Data.Vector.Unboxed.Base
15+
-- Module : Data.Vector.Unboxed.Unsafe
1616
-- Copyright : (c) Roman Leshchinskiy 2009-2010
1717
-- Alexey Kuleshevich 2020-2022
1818
-- Aleksey Khudyakov 2020-2022
@@ -23,8 +23,14 @@
2323
-- Stability : experimental
2424
-- Portability : non-portable
2525
--
26-
-- Adaptive unboxed vectors: basic implementation.
27-
26+
-- Adaptive unboxed vectors. This module exposes internal
27+
-- representation for all unboxed vectors. Both pure and mutable
28+
-- vectors are exposed from this module.
29+
--
30+
-- Note that working with internal representation is generally unsafe
31+
-- and may violate memory safety. Data family constructors which are
32+
-- safe exposed in "Data.Vector.Unboxed" and
33+
-- "Data.Vector.Unboxed.Mutable" modules.
2834
module Data.Vector.Unboxed.Unsafe (
2935
MVector(..), IOVector, STVector, Vector(..), Unbox,
3036
UnboxViaPrim(..), UnboxViaStorable(..), As(..), IsoUnbox(..),

vector/src/Data/Vector/Unsafe.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
{-# LANGUAGE RankNTypes #-}
66
{-# LANGUAGE TypeFamilies #-}
77
-- |
8+
-- This module exposes internal representation of lazy boxed vector
9+
-- and functions that work on that representation directly (as opposed
10+
-- to using 'G.Vector' API.
11+
--
12+
-- Note that working with internal representation of vector is
13+
-- generally unsafe and may violate memory safety
814
module Data.Vector.Unsafe
915
( Vector(..)
1016
-- * Array conversions
@@ -44,7 +50,7 @@ import qualified Data.Traversable as Traversable
4450
import qualified GHC.Exts as Exts (IsList(..))
4551

4652

47-
-- | Boxed vectors, supporting efficient slicing.
53+
-- | Lazy boxed vectors, supporting efficient slicing.
4854
data Vector a = Vector {-# UNPACK #-} !Int
4955
{-# UNPACK #-} !Int
5056
{-# UNPACK #-} !(Array a)

0 commit comments

Comments
 (0)