++

(++) appends two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.

Performance considerations

This function takes linear time in the number of elements of the first list. Thus it is better to associate repeated applications of (++) to the right (which is the default behaviour): xs ++ (ys ++ zs) or simply xs ++ ys ++ zs, but not (xs ++ ys) ++ zs. For the same reason concat = foldr (++) [] has linear performance, while foldl (++) [] is prone to quadratic slowdown

Examples

>>> [1, 2, 3] ++ [4, 5, 6]
[1,2,3,4,5,6]
>>> [] ++ [1, 2, 3]
[1,2,3]
>>> [3, 2, 1] ++ []
[3,2,1]
Append two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list. WARNING: This function takes linear time in the number of elements of the first list.
An infix synonym for AppendSymbol.
Concatenates type-level lists.
>>> :kind! '[ 'Just 5, 'Nothing] ++ '[ 'Just 3, 'Nothing, 'Just 1]
'[ 'Just 5, 'Nothing] ++ '[ 'Just 3, 'Nothing, 'Just 1] :: [Maybe
Natural]
= '[ 'Just 5, 'Nothing, 'Just 3, 'Nothing, 'Just 1]
>>> :kind! '[] ++ '[ 'Just 3, 'Nothing, 'Just 1]
'[] ++ '[ 'Just 3, 'Nothing, 'Just 1] :: [Maybe Natural]
= '[ 'Just 3, 'Nothing, 'Just 1]
# 91 "srcReludeExtra/Type.hs"
Append for type-level lists.
Append two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
O(m+n) Concatenate two vectors
O(m+n) Concatenate two vectors
O(m+n) Concatenate two vectors
O(m+n) Concatenate two vectors
Append two arrays.
List catenation.

Example

>>> data Example where Ex :: a -> Example  -- Hide the type of examples to avoid brittleness in different GHC versions

>>> :kind! Ex (Eval ([1, 2] ++ [3, 4]) :: [Natural])
Ex (Eval ([1, 2] ++ [3, 4]) :: [Natural]) :: Example
= Ex [1, 2, 3, 4]
(++) = mappend
Append two type-level lists together.
O(m+n) Concatenate two vectors.
O(m+n) Concatenate two vectors.
O(m+n) Concatenate two vectors.
O(m+n) Concatenate two vectors.
O(m+n) Concatenate two vectors.
Append two vectors.
>>> (1:>2:>3:>Nil) ++ (7:>8:>Nil)
1 :> 2 :> 3 :> 7 :> 8 :> Nil
Concatenate type level lists