Skip to content

Commit

Permalink
Improve fromList docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMaryW committed Jul 25, 2024
1 parent 5d4226e commit c52ac05
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
8 changes: 7 additions & 1 deletion vector/src/Data/Vector.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,13 @@ toList :: Vector a -> [a]
{-# INLINE toList #-}
toList = G.toList

-- | /O(n)/ Convert a list to a vector.
-- | /O(n)/ Convert a list to a vector. During the operation, the
-- vector’s capacity will be doubling until the list's contents are
-- in the vector. Depending on the list’s size, up to half of the vector’s
-- capacity might be empty. If you’d rather avoid this, you can use
-- 'fromListN', which will provide the exact space the list requires but will
-- prevent list fusion, or @'force' . 'fromList'@, which will create the
-- vector and then copy it without the superfluous space.
fromList :: [a] -> Vector a
{-# INLINE fromList #-}
fromList = G.fromList
Expand Down
8 changes: 7 additions & 1 deletion vector/src/Data/Vector/Generic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,13 @@ toList :: Vector v a => v a -> [a]
{-# INLINE toList #-}
toList = Bundle.toList . stream

-- | /O(n)/ Convert a list to a vector.
-- | /O(n)/ Convert a list to a vector. During the operation, the
-- vector’s capacity will be doubling until the list's contents are
-- in the vector. Depending on the list’s size, up to half of the vector’s
-- capacity might be empty. If you’d rather avoid this, you can use
-- 'fromListN', which will provide the exact space the list requires but will
-- prevent list fusion, or @'force' . 'fromList'@, which will create the
-- vector and then copy it without the superfluous space.
fromList :: Vector v a => [a] -> v a
{-# INLINE fromList #-}
fromList = unstream . Bundle.fromList
Expand Down
8 changes: 7 additions & 1 deletion vector/src/Data/Vector/Primitive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,13 @@ toList :: Prim a => Vector a -> [a]
{-# INLINE toList #-}
toList = G.toList

-- | /O(n)/ Convert a list to a vector.
-- | /O(n)/ Convert a list to a vector. During the operation, the
-- vector’s capacity will be doubling until the list's contents are
-- in the vector. Depending on the list’s size, up to half of the vector’s
-- capacity might be empty. If you’d rather avoid this, you can use
-- 'fromListN', which will provide the exact space the list requires but will
-- prevent list fusion, or @'force' . 'fromList'@, which will create the
-- vector and then copy it without the superfluous space.
fromList :: Prim a => [a] -> Vector a
{-# INLINE fromList #-}
fromList = G.fromList
Expand Down
8 changes: 7 additions & 1 deletion vector/src/Data/Vector/Storable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,13 @@ toList :: Storable a => Vector a -> [a]
{-# INLINE toList #-}
toList = G.toList

-- | /O(n)/ Convert a list to a vector.
-- | /O(n)/ Convert a list to a vector. During the operation, the
-- vector’s capacity will be doubling until the list's contents are
-- in the vector. Depending on the list’s size, up to half of the vector’s
-- capacity might be empty. If you’d rather avoid this, you can use
-- 'fromListN', which will provide the exact space the list requires but will
-- prevent list fusion, or @'force' . 'fromList'@, which will create the
-- vector and then copy it without the superfluous space.
fromList :: Storable a => [a] -> Vector a
{-# INLINE fromList #-}
fromList = G.fromList
Expand Down
8 changes: 7 additions & 1 deletion vector/src/Data/Vector/Strict.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,13 @@ toList :: Vector a -> [a]
{-# INLINE toList #-}
toList = G.toList

-- | /O(n)/ Convert a list to a vector.
-- | /O(n)/ Convert a list to a vector. During the operation, the
-- vector’s capacity will be doubling until the list's contents are
-- in the vector. Depending on the list’s size, up to half of the vector’s
-- capacity might be empty. If you’d rather avoid this, you can use
-- 'fromListN', which will provide the exact space the list requires but will
-- prevent list fusion, or @'force' . 'fromList'@, which will create the
-- vector and then copy it without the superfluous space.
--
-- @since 0.13.2.0
fromList :: [a] -> Vector a
Expand Down
8 changes: 7 additions & 1 deletion vector/src/Data/Vector/Unboxed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,13 @@ toList :: Unbox a => Vector a -> [a]
{-# INLINE toList #-}
toList = G.toList

-- | /O(n)/ Convert a list to a vector.
-- | /O(n)/ Convert a list to a vector. During the operation, the
-- vector’s capacity will be doubling until the list's contents are
-- in the vector. Depending on the list’s size, up to half of the vector’s
-- capacity might be empty. If you’d rather avoid this, you can use
-- 'fromListN', which will provide the exact space the list requires but will
-- prevent list fusion, or @'force' . 'fromList'@, which will create the
-- vector and then copy it without the superfluous space.
fromList :: Unbox a => [a] -> Vector a
{-# INLINE fromList #-}
fromList = G.fromList
Expand Down

0 comments on commit c52ac05

Please sign in to comment.