put haskell-mode hooks into a function