summary refs log tree commit diff
path: root/emacs.org
diff options
context:
space:
mode:
Diffstat (limited to 'emacs.org')
-rw-r--r--emacs.org50
1 files changed, 50 insertions, 0 deletions
diff --git a/emacs.org b/emacs.org
index 9b06cb4..1fd9cd6 100644
--- a/emacs.org
+++ b/emacs.org
@@ -417,6 +417,56 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
 	 (setq elpy-rpc-python-command python-shell-interpreter))
 
      #+end_src
+**** Haskell
+     I have to use haskell in my new module, so there is now some haskell infra for that
+     first we have to set up a nix environment for our haskell tools
+     #+begin_src emacs-lisp :tangle emacsconfig/haskell.el
+       (setq haskell-env (nix-env-from-packages "Haskell"
+                                                "ghc"
+                                                "cabal-install"
+                                                "haskellPackages.fourmolu"))
+     #+end_src
+     Then haskell-mode setup, which integrates company mode as well as the sandbox
+     #+begin_src emacs-lisp :tangle emacsconfig/haskell.el
+       (use-package haskell-mode
+         :after nix-sandbox
+         :hook
+         (haskell-mode . set-haskell-company-backends)
+         (haskell-mode . company-mode)
+         (haskell-mode . haskell-indentation-mode)
+         :config
+         (setq haskell-process-wrapper-function
+               (lambda (args)
+                 (cons
+                  (nix-executable-find haskell-sandbox (car args))
+                  (cdr args))))
+         (defun set-haskell-company-backends ()
+           (set (make-local-variable 'company-backends)
+                '((dante-company company-files)))))
+     #+end_src
+     ormolu formats my haskell files, though I use fourmolu since I prefer prefixing chained infix functions
+     #+begin_src emacs-lisp :tangle emacsconfig/haskell.el
+       (use-package ormolu
+         :after haskell-mode
+         :hook
+         (haskell-mode . ormolu-format-on-save-mode)
+         (haskell-mode . (lambda ()
+                           (set (make-local-variable 'ormolu-process-path)
+                                (nix-executable-find haskell-env "fourmolu"))))
+         :bind
+         (:map haskell-mode-map
+               ("C-c r" . ormolu-format-buffer)))
+     #+end_src
+     Finally, dante runs as background interpreter of my haskell codes and checks stuff for errors
+     #+begin_src emacs-lisp :tangle emacsconfig/haskell.el
+       (use-package dante
+         :after haskell-mode
+         :hook
+         (haskell-mode . dante-mode)
+         :custom
+         (dante-methods '(nix-ghci bare-cabal bare-ghci)))
+     #+end_src
+
 **** Web stuff
      I also have made some basic webpages. I haven't gotten too deep into JS with emacs yet, so this section
      might expand later, but so far this is what I have