summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrazazy2022-04-23 00:11:49 +0200
committerCrazazy2022-04-23 00:11:49 +0200
commit9dcdc9e4312476a6a1add7ac41220a4d0c93b799 (patch)
tree16b7141a1c349bee350da8029d40b8fd0fc5729c
parent9c89ac20557637eed31ce78f43802d96cf7a503b (diff)
add haskell
-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