Transitioning from JavaScript to Haskell