Convert Cpp code to Haskell

Input code

Output code