on master help sign in
Update the hie-bios commit SHA (#1825)

* Update the hie-bios commit SHA * Also update the SHA in our bazel WORKSPACE * Update the hash too * Tutorial for Emacs integration * Update hie-bios patch

commit59e871c6e8383a6bffaac17d32422c96f3a36c42 authorShayne Fletcher <shayne.fletcher@digitalasset.com> dateSat 22 Jun 2019, 12:01 (7 years ago) parentf46fff9
2 files changed+51−1
hie-core-in-emacs.md+50 stack.yaml+1−1
hie-core-in-emacs.mdnew file+50
@@ -0,0 +1,50 @@
1+# How to get `hie-core` working in Emacs
2+
3+First step is to install required Emacs packages. If you don't already have Melpa config stuff in your `.emacs`, put this stanza at the top.
4+```
5+;;Melpa packages support
6+(require 'package)
7+(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
8+ (not (gnutls-available-p))))
9+ (proto (if no-ssl "http" "https")))
10+ (when no-ssl
11+ (warn "\
12+Your version of Emacs does not support SSL connections,
13+which is unsafe because it allows man-in-the-middle attacks.
14+There are two things you can do about this warning:
15+1. Install an Emacs version that does support SSL and be safe.
16+2. Remove this warning from your init file so you won't see it again."))
17+ ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
18+ (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
19+ ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
20+ (when (< emacs-major-version 24)
21+ ;; For important compatibility libraries like cl-lib
22+ (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
23+(package-initialize)
24+;; Remember : to avoid package-not-found errors, refresh the package
25+;; database now and then with M-x package-refresh-contents.
26+```
27+
28+When this is in your `.emacs` and it's been evaluated, `M-x package-refresh-contents` to get the package database downloaded and then `M-x package-list-packages` to display the available packages. Click on a package to install it. You'll need to install the following packages.
29+- `lsp-haskell`
30+- `lsp-ui`
31+- `flycheck`
32+- `yasnippet`
33+
34+When done with this, add the following lines to your `.emacs` :
35+```
36+;; lsp-haskell
37+(require 'lsp)
38+(require 'lsp-haskell)
39+(require 'yasnippet)
40+(add-hook 'haskell-mode-hook #'lsp)
41+(setq lsp-haskell-process-path-hie "hie-core")
42+(setq lsp-haskell-process-args-hie '())
43+(setq lsp-log-io t) ;; Inspect comms betweeen lsp client/server
44+```
45+
46+Next stop is to build `hie-core`. In the `daml` repository, navigate to `//compiler/hie-core` and invoked `stack build`. This will install the `hie-core` executable into a location along the lines of `/Users/shaynefletcher/project/daml.git/compiler/hie-core/.stack-work/install/x86_64-osx/nightly-2019-05-20/8.6.5/bin/hie-core`. You want to get this executable in your `$PATH`. I achieved this by `ln -s /Users/shaynefletcher/project/daml.git/compiler/hie-core/.stack-work/install/x86_64-osx/nightly-2019-05-20/8.6.5/bin/hie-core ~/.local/bin/hie-core` (because `~/.local/bin` is put in my `PATH` in my `~/.bashrc`).
47+
48+Time to test things out. It's important to note that you for this to work, your programs need to be compiled with the same compiler used to build `hie-core`. For testing, I've been using the `ghc-lib-gen` target of the `ghc-lib` project). Navigate to the root of `ghc-lib`, create an `hie.yaml` file with contents `cradle: {cabal: {component: "exe:ghc-lib-gen"}}`. Invoke `cabal new-configure -w ~/.stack/programs/~/.stack/programs/x86_64-osx/ghc-8.6.5/bin/ghc` (this is the `ghc` used by `stack` to build `hie-core` - consult `//compiler/hie-core/stack.yaml` to help work out what you should write here). This last step will create a file `cabal.project.local` with contents pointing `cabal` to use the desired `ghc`. You can build `ghc-lib-gen` from the `ghc-lib` directory with the command `cabal new-build` as you like.
49+
50+After the last step, you should be all set. Open `ghc-lib/ghc-lib-gen/src/Main.hs` in an Emacs buffer and, for example, hover should bring up type/definition info.
stack.yaml+1−1
@@ -9,6 +9,6 @@ extra-deps:
99 - .
1010 - haskell-lsp-types
1111- git: https://github.com/mpickering/hie-bios.git
12− commit: 9f9fe00591c429c410475349560252ca7e622f1b
12+ commit: 8427e424a83c2f3d60bdd26c02478c00d2189a73
1313nix:
1414 packages: [zlib]