You may use
per-buffer-theme.el. For example you could start with a setup like this:
(setq per-buffer-theme/use-timer t)
(setq per-buffer-theme/timer-idle-delay 0.1)
(setq per-buffer-theme/default-theme 'notheme)
'(((:theme . dichromacy)
haskell-interactive-mode)))) ; Is this the mode the Haskell REPL in Emacs uses? I'm not sure.
In my testing it has worked best with
per-buffer-theme/use-timer set to non-nil. Also, you may want to tell
per-buffer-theme to avoid changing themes for some buffers (say, Help buffers). You can do it with the
(append ido-ignore-buffers '("*Completions*" "*Help*" "*info*" "*Warnings*")
This question had been asked on Stack Overflow a few years ago: Different color themes per mode in Emacs. There are other approaches there but notice that most answers are old and better solutions could have come up since then.