diff --git a/src/Data/Vector/NonEmpty.hs b/src/Data/Vector/NonEmpty.hs index c44eac6..0d2e0b0 100644 --- a/src/Data/Vector/NonEmpty.hs +++ b/src/Data/Vector/NonEmpty.hs @@ -18,11 +18,11 @@ -- -- This library attempts to provide support for all standard 'Vector' operations -- in the API, with some slight variation in types and implementation. For example, --- since 'head' and 'foldr' are always gauranteed to be over a non-empty 'Vector', +-- since 'head' and 'foldr' are always guaranteed to be over a non-empty 'Vector', -- it is safe to make use of the 'unsafe-*' 'Vector' operations and semigroupal -- folds available in the API in lieu of the standard implementations. -- --- In contrast, some operations such as 'filter' may "break out" of a 'NonEmptyVector' +-- In contrast, some operations such as 'filter' may "break out" of a t'NonEmptyVector' -- due to the fact that there are no guarantees that may be made on the types of -- 'Bool'-valued functions passed in, hence one could write the following: -- @@ -31,10 +31,10 @@ -- @ -- -- which always produces an empty vector. Thus, some operations must return either --- a 'Maybe' containing a 'NonEmptyVector' or a 'Vector' whenever appropriate. Generally +-- a 'Maybe' containing a t'NonEmptyVector' or a 'Vector' whenever appropriate. Generally -- The former is used in initialization and generation operations, and the latter -- is used in iterative operations where the intent is not to create an instance --- of 'NonEmptyVector'. +-- of t'NonEmptyVector'. -- -- Credit to Roman Leshchinskiy for the original Vector library upon which this is based. -- @@ -232,8 +232,8 @@ length :: NonEmptyVector a -> Int length = V.length . _neVec {-# INLINE length #-} --- | /O(1)/ First element. Since head is gauranteed, bounds checks --- are bypassed by deferring to 'unsafeHead'. +-- | /O(1)/ First element. Since head is guaranteed, bounds checks +-- are bypassed by deferring to 'Data.Vector.unsafeHead'. -- -- -- >>> head $ unsafeFromList [1..10] @@ -243,8 +243,8 @@ head :: NonEmptyVector a -> a head = V.unsafeHead . _neVec {-# INLINE head #-} --- | /O(1)/ Last element. Since a last element is gauranteed, bounds checks --- are bypassed by deferring to 'unsafeLast'. +-- | /O(1)/ Last element. Since a last element is guaranteed, bounds checks +-- are bypassed by deferring to 'Data.Vector.unsafeLast'. -- -- -- >>> last $ unsafeFromList [1..10] @@ -291,7 +291,7 @@ unsafeIndex (NonEmptyVector as) n = V.unsafeIndex as n -- The monad allows operations to be strict in the non-empty vector when -- necessary. -- --- See 'V.indexM' for more details +-- See 'Data.Vector.indexM' for more details -- -- -- >>> indexM @[] (unsafeFromList [1..10]) 3 @@ -303,10 +303,10 @@ indexM (NonEmptyVector v) n = V.indexM v n -- | /O(1)/ First element of a non-empty vector in a monad. -- --- See 'V.indexM' for an explanation of why this is useful. +-- See 'Data.Vector.indexM' for an explanation of why this is useful. -- --- Note that this function defers to 'unsafeHeadM' since head is --- gauranteed to be safe by construction. +-- Note that this function defers to 'Data.Vector.unsafeHeadM' since head is +-- guaranteed to be safe by construction. -- -- -- >>> headM @[] (unsafeFromList [1..10]) @@ -316,11 +316,11 @@ headM :: Monad m => NonEmptyVector a -> m a headM (NonEmptyVector v) = V.unsafeHeadM v {-# INLINE headM #-} --- | /O(1)/ Last element of a non-empty vector in a monad. See 'V.indexM' for an --- explanation of why this is useful. +-- | /O(1)/ Last element of a non-empty vector in a monad. See 'Data.Vector.indexM' +-- for an explanation of why this is useful. -- --- Note that this function defers to 'unsafeHeadM' since a last element is --- gauranteed. +-- Note that this function defers to 'Data.Vector.unsafeLastM' since a last element is +-- guaranteed. -- -- -- >>> lastM @[] (unsafeFromList [1..10]) @@ -1735,7 +1735,7 @@ izipWith6 k a b c d e f = NonEmptyVector (V.izipWith6 k a' b' c' d' e' f') {-# INLINE izipWith6 #-} -- | /O(min(n,m))/ Elementwise pairing of non-empty vector elements. This is a special case --- of 'zipWith' where the function argument is '(,)' +-- of 'zipWith' where the function argument is @(,)@ -- zip :: NonEmptyVector a -> NonEmptyVector b -> NonEmptyVector (a, b) zip a b = NonEmptyVector (V.zip a' b') @@ -2013,7 +2013,7 @@ filterM f = V.filterM f . _neVec -- -- If no elements satisfy the predicate, the resulting vector may be empty. -- --- TODO: this should be a more efficient function in `vector`. +-- TODO: this should be a more efficient function in @vector@. -- -- >>> ifilterM (\i a -> if a == 2 || i == 0 then Just False else Just True) (unsafeFromList [1..3]) -- Just [3] @@ -2651,8 +2651,8 @@ iscanr' :: (Int -> a -> b -> b) -> b -> NonEmptyVector a -> NonEmptyVector b iscanr' f b = NonEmptyVector . V.iscanr' f b . _neVec {-# INLINE iscanr' #-} --- | /O(n)/ The 'intersperse' function takes an element and a NonEmptyVector --- and 'intersperses' that element between the elements of the NonEmptyVector. +-- | /O(n)/ The 'intersperse' function takes an element and a 'NonEmptyVector' +-- and "intersperses" that element between the elements of the 'NonEmptyVector'. -- -- >>> intersperse 0 (unsafeFromList [1,2,3]) -- [1,0,2,0,3] diff --git a/src/Data/Vector/NonEmpty/Internal.hs b/src/Data/Vector/NonEmpty/Internal.hs index c2c48b1..1d37be2 100644 --- a/src/Data/Vector/NonEmpty/Internal.hs +++ b/src/Data/Vector/NonEmpty/Internal.hs @@ -12,7 +12,7 @@ -- Portability : non-portable -- -- Internal module exposing the constructors for --- 'NonEmptyVector' and 'NonEmptyMVector'. +-- t'NonEmptyVector' and t'NonEmptyMVector'. -- -- /Warning/: Since the constructors are exposed here, by using this -- module, you take on the risks that you break the non-emptiness @@ -54,13 +54,13 @@ import qualified Text.Read as Read -- ---------------------------------------------------------------------- -- -- Non-empty immutable vectors --- | 'NonEmptyVector' is a thin wrapper around 'Vector' that +-- | t'NonEmptyVector' is a thin wrapper around 'Data.Vector.Vector' that -- witnesses an API requiring non-empty construction, -- initialization, and generation of non-empty vectors by design. -- -- A newtype wrapper was chosen so that no new pointer indirection --- is introduced when working with 'Vector's, and all performance --- characteristics inherited from the 'Vector' API still apply. +-- is introduced when working with 'Data.Vector.Vector's, and all performance +-- characteristics inherited from the "Data.Vector" API still apply. -- -- @since 0.2.1.0 -- @@ -98,8 +98,8 @@ instance Foldable NonEmptyVector where instance Foldable1 NonEmptyVector where foldMap1 f (NonEmptyVector v) = let - h = V.unsafeHead v -- gauranteed head (nonemptiness) - t = V.unsafeTail v -- gauranteed possibly empty tail + h = V.unsafeHead v -- guaranteed head (nonemptiness) + t = V.unsafeTail v -- guaranteed possibly empty tail in go (f h) t -- therefore this is a sound call where go x xs @@ -119,7 +119,7 @@ instance Traversable NonEmptyVector where -- ---------------------------------------------------------------------- -- -- Non-empty mutable vectors --- | 'NonEmptyMVector' is a thin wrapper around 'MVector' that +-- | t'NonEmptyMVector' is a thin wrapper around 'MVector' that -- witnesses an API requiring non-empty construction, -- initialization, and generation of non-empty vectors by design. -- @@ -135,13 +135,13 @@ newtype NonEmptyMVector s a = NonEmptyMVector deriving (Typeable) #endif --- | 'NonEmptyMVector' parametrized by 'PrimState' +-- | t'NonEmptyMVector' parametrized by 'Control.Monad.Primitive.PrimState' 'IO'. -- -- @since 0.2.1.0 -- type NonEmptyIOVector = NonEmptyMVector RealWorld --- | 'NonEmptyMVector' parametrized by 'ST' +-- | t'NonEmptyMVector' parametrized by @t'Control.Monad.Primitive.PrimState' ('ST' s)@. -- -- @since 0.2.1.0 --