Goto Definition in Emacs - Haskell mode

emacs, haskell

Solution

`haskell-mode-jump-to-def` isn't bound by default, but you can bind it yourself:

Using GHCi

You can bind the following to use GHCi to find definitions of things:

(define-key haskell-mode-map (kbd "M-.") 'haskell-mode-jump-to-def)

The one problem with this approach is that if your code doesn't compile, GHCi doesn't give any location info. So you need to make sure your code compiles and the modules you want to jump to are loaded byte-compiled.

Alternatively, you can use a tags file or GHCi / tags hybrid approach as suggested later on that same page.

Problem

I installed `Haskell Mode` through Melpa `package-install`. However, `M - .` (`goto-definition)` still uses emacs' inbuilt findTags function. Doesn't haskell mode has this goto function definition feature?

Original source