import { Maybe, Nothing } from '@typed/maybe' /** * Returns the last value in a given list * @param list :: [a] * @returns :: Maybe a */ export const last = (list: ArrayLike): Maybe => list.length === 0 ? Nothing : Maybe.of(list[list.length - 1])