Maximum subarray algorithm implementation in Haskell