I recently came across a video (https://youtu.be/UogkQ67d0nY?t=703) that looked at a problem and compared the solutions in Scala and Haskell.
The scala solution:
def maximumDifference(nums: Array[Int]): Int =
nums.scanLeft(Int.MaxValue)(_ min _)
.tail