Hamish Rickerby

Menu

  • Home
  • Archives
  • Tags
  • About Hamish
  • RSS
January 25, 2023

Configuring Dhall with Emacs

I use Dhall with archlinux, and emacs, but don't use use-package. The documentation at https://docs.dhall-lang.org/howtos/Text-Editor-Configuration.html#EMACS assumes you do use this, but I use prelude to simplify a bunch of my emacs setup, and am not interested in another tool that does similar setup work.

To get Dhall (and in particular, the lsp server) setup, the following steps worked for me.

  1. Install dhall, dhall-json, and dhall-lsp-server:
pacman -Syu dhall dhall-json dhall-lsp-server
  1. Ensure they're on the path, and smoke-test dhall-json:
dhall-to-json <<< '{ foo = [1, 2, 3], bar = True }'
  1. Install dhall-mode in emacs
M-x package-install
Type dhall-mode
Then enter to install
  1. Configure emacs to use dhall, and the lsp server
;; Setup Dhall
(require 'dhall-mode)
(setq
 ;; comment the next line to use unicode syntax
 dhall-format-arguments (\` ("--ascii"))

 ;; header-line is obsoleted by lsp-mode
 dhall-use-header-line nil)

(add-hook 'dhall-mode-hook 'lsp)
  1. Evaluate the above in emacs, and then open a .dhall file. lsp should start up, and be ready to go.

You can test the integration with the following configuration file

let user = "Dhall"

let welcome = \(name : Text) -> "Welcome ${name}"

in  welcome user ++ 42

It should warn you on the last line with Error: (++) only works on (Text)


Tags: linux emacs dhall

View Comments
Baby's First GEM Program »

Copyright © 2023 Hamish Rickerby

Powered by Cryogen | Free Website Template by Download Website Templates