:: [a] -> a -> [a] package:deriving-compat

Replace the last element of a list with another element.