haskell-mode-buffer-apply-command: use a temporary file

Prior behavior clobbered markers, registers, and the undo stack. Using a
temporary file here allows us to switch to insert-file-contents, which has a
"replace" mode that replaces the buffer contents while attempting to maintain
marker positions.

Also twiddled the buffer-modified-p settings to make the undo stack set itself
properly.