 
 (defhydra hydra-haskell (:hint nil)
   "
-^Imports^     ^GHCi^        ^Insert^            ^Run
+^Imports^     ^GHCi^        ^Insert/Edit^       ^Run
 ^^^^^^^^^----------------------------------------------------
 _i_: jump     _g_: ghci     _S_: cost center    _c_: compile
-_I_: return   _r_: reload   ^ ^                 _R_: run
-_s_: sort     _t_: type     ^ ^
+_I_: return   _r_: reload   _m_: new module     _R_: run
+_s_: sort     _t_: type     _M_: kill module
+^ ^           ^ ^           _e_: edit cabal
 "
-  ("i" haskell-navigate-imports)
   ("I" haskell-navigate-imports-return :color blue)
-  ("s" haskell-sort-imports)
-  ("g" haskell-interactive-switch :color blue)
-  ("r" haskell-process-reload)
-  ("t" haskell-process-do-type :color blue)
+  ("M" pjones:haskell-module-name-to-kill-ring :color blue)
+  ("R" projectile-run-project :color blue)
   ("S" haskell-mode-toggle-scc-at-point :color blue)
   ("c" pjones:haskell-compile :color blue)
-  ("R" projectile-run-project :color blue))
+  ("e" pjones:haskell-edit-cabal-file :color blue)
+  ("g" haskell-interactive-switch :color blue)
+  ("i" haskell-navigate-imports)
+  ("m" pjones:haskell-new-module :color blue)
+  ("r" haskell-process-reload)
+  ("s" haskell-sort-imports)
+  ("t" haskell-process-do-type :color blue))
 
 (define-skeleton pjones:haskell-insert-pragma
   "Add the pragma comment syntax." nil "{-# " _ " #-}")
+
+(defun pjones:haskell-nixpkgs-wrapper-function (argv)
+  "Function that can be used with the
+`haskell-process-wrapper-function' variable to force building
+with my custom nix-hs-shell script."
+  (append (list "nix-hs-shell" "--run")
+          (list (mapconcat 'identity argv " "))))
 
 (defun pjones:haskell-mode-hook ()
   "Hook run on new Haskell buffers."


  ;; These need to be set before calling `pjones:prog-mode-hook'.
  (setq tab-always-indent t
        haskell-stylish-on-save nil
        haskell-completing-read-function 'ivy-completing-read
        haskell-indentation-layout-offset 0
        haskell-indentation-starter-offset 2
        haskell-indentation-left-offset 2
        haskell-indentation-ifte-offset 2
        haskell-indentation-where-pre-offset 2
        haskell-indentation-where-post-offset 2
        beginning-of-defun-function 'pjones:haskell-beginning-of-defun
        end-of-defun-function 'pjones:haskell-end-of-defun
        projectile-project-compilation-cmd "nix-hs-build"
        ghc-module-command "nix-hs-ghc-mod"

        haskell-compile-cabal-build-command "nix-hs-build"
        haskell-process-type 'cabal-repl
        haskell-process-suggest-language-pragmas t
        haskell-process-suggest-remove-import-lines t
        haskell-interactive-popup-errors nil
        haskell-process-wrapper-function ; Run commands via nix-hs-shell:
          (lambda (argv) (append (list "nix-hs-shell" "--run")
                                 (list (mapconcat 'identity argv " ")))))

  (pjones:prog-mode-hook)
  (subword-mode)

  (find-file (pjones:haskell-find-cabal-file)))

(defun pjones:haskell-compile ()
  "Compile the current project using
`haskell-compile-cabal-build-command'."
  (interactive)
  (let* ((cabal-file (pjones:haskell-find-cabal-file))
         (default-directory (file-name-directory cabal-file)))
