[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.
>>> [1, 2, 3] ++ [4, 5, 6] [1,2,3,4,5,6]
>>> [] ++ [1, 2, 3] [1,2,3]
>>> [3, 2, 1] ++ [] [3,2,1]
[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.
>>> :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"
[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.
>>> 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]
>>> (1:>2:>3:>Nil) ++ (7:>8:>Nil) 1 :> 2 :> 3 :> 7 :> 8 :> Nil
>>> sat $ \x y z -> length x .== 5 .&& length y .== 1 .&& x ++ y ++ z .== [1 .. 12] Satisfiable. Model: s0 = [1,2,3,4,5] :: [Integer] s1 = [6] :: [Integer] s2 = [7,8,9,10,11,12] :: [Integer]