Re: How to exploit ./hadrian/ghci to find errors quickly?

2022-01-28 Thread Tom Ellis
On Fri, Jan 28, 2022 at 11:52:00AM -0500, Norman Ramsey wrote:
>  > My recommendation: ./hadrian/ghci. 
> 
> I'm about to change a type definition.  This change may wreak havoc in
> many parts of GHC, and this is exactly what I want: I'm looking for
> type-error messages that will tell me what code I need to fix.
> I do this work in emacs using `M-x compile` and `next-error`.  The key
> property is that `next-error` requires just a couple of keystrokes
> (C-x `) and it makes Emacs take me to the relevant source-code
> location quickly.
> 
> But telling `M-x compile` to run `./hadrian/build` is quite slow.  Is
> there a way to leverage `./hadrian/ghci` for this workflow?

Are you familiar with dante-mode for Emacs?  It relies on ghci behind
the scenes to point out type errors in Emacs Haskell buffers.  You
might find it convenient even if only for this single-purpose use
case.  I wrote up how I use dante:

http://h2.jaguarpaw.co.uk/posts/how-i-use-dante/

You will have to `M-x customize-group dante` to set the GHCi path to
`.../hadrian/ghci`.

Tom
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: How to exploit ./hadrian/ghci to find errors quickly?

2022-01-28 Thread Sebastian Graf

This is the typical use case for a language server.
I have haskell-language-server installed and use it extensively on GHC 
for stuff like jump to definition and immediate compilation feedback.

There's also "jump to next error" if you want that.

Installation was pretty trivial for me, just flipping this switch in my 
local ghc.nix clone: 
https://github.com/alpmestan/ghc.nix/blob/88acad6229300d8917ad226a64de80aa491ffa07/default.nix#L19

You will probably have to install an LSP plugin for emacs first.

The hour or so I invested on initial setup has probably saved me several 
days already.


Sebastian

-- Originalnachricht --
Von: "Norman Ramsey" 
An: ghc-devs@haskell.org
Gesendet: 28.01.2022 17:52:00
Betreff: How to exploit ./hadrian/ghci to find errors quickly?


 > My recommendation: ./hadrian/ghci.

Richard, this suggestion has been so useful that I would like to
follow it up.

I'm about to change a type definition.  This change may wreak havoc in
many parts of GHC, and this is exactly what I want: I'm looking for
type-error messages that will tell me what code I need to fix.
I do this work in emacs using `M-x compile` and `next-error`.  The key
property is that `next-error` requires just a couple of keystrokes
(C-x `) and it makes Emacs take me to the relevant source-code
location quickly.

But telling `M-x compile` to run `./hadrian/build` is quite slow.  Is
there a way to leverage `./hadrian/ghci` for this workflow?


Norman
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: How to exploit ./hadrian/ghci to find errors quickly?

2022-01-28 Thread Norman Ramsey
 > This is the typical use case for a language server.
 > I have haskell-language-server installed and use it extensively on GHC 
 > for stuff like jump to definition and immediate compilation feedback.

I would *love* to be doing this.  I have had HLS installed on my
machine for months, and have been using with Emacs.  But to say I have
trouble getting it work as advertised is an understatement.

For example, on the module I'm trying to diagnose, I'm getting just
one error message, on the first line:

  Data.Binary.Get.runGet at position 1844: not enough bytes

 > There's also "jump to next error" if you want that.

I can't find it using either "C-h f" or using the list of keybindings
at https://emacs-lsp.github.io/lsp-mode/page/keybindings/.  I think it
might be supported by flycheck, but "C-x `" simply says "No more
Flycheck errors."

In general, my experience is "sometimes it works and sometimes it
doesn't."  Even for things as simple as "M-." (find definition).

If you know of any resources on using HLS with GHC, I'd love to be
directed.  For example, when Emacs asks if I really want to watch
circa 5,000 directories, do I say "yes"?

 > The hour or so I invested on initial setup has probably saved me several 
 > days already.

I am **so eager** to get there.  But definitely not there yet.


Norman
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: How to exploit ./hadrian/ghci to find errors quickly?

2022-01-28 Thread Sam Derbyshire
The Binary runGet issue usually means that your build tree is out of date.
It's probably worth deleting and building from scratch again.
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: How to exploit ./hadrian/ghci to find errors quickly?

2022-01-28 Thread Norman Ramsey
 > The Binary runGet issue usually means that your build tree is out of date.
 > It's probably worth deleting and building from scratch again.

Brilliant!  Definitely working much better!

And @Sebastian I start to see the productivity gains.  Remove all
redundant imports with one click!


Norman
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: How to exploit ./hadrian/ghci to find errors quickly?

2022-02-01 Thread Norman Ramsey
 > The Binary runGet issue usually means that your build tree is out of date.
 > It's probably worth deleting and building from scratch again.

For those who may come after me: if ./hadrian/ghci barfs with a Binary
runGet issue, the build tree that needs to be deleted is
`.hadrian_ghci`, not `_build`.


NR


___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: How to exploit ./hadrian/ghci to find errors quickly?

2022-02-02 Thread Norman Ramsey
 > > [Finding the locations of compiler errors after a change]
 > 
 > This is the typical use case for a language server.
 > I have haskell-language-server installed and use it extensively on GHC 
 > for stuff like jump to definition and immediate compilation feedback.
 >
 > There's also "jump to next error" if you want that.

I've now reached the stage where I make a change in a module, and it
compiles, but the change causes a compiler error in another module far
away.  Is there a way to ask the language server to jump to an error
in another module?  (I'm using Emacs lsp-mode, and all I've found for
errors is `flycheck-next-error`, which is not ideal.  But if the
language server can monitor the whole project, I'll get some Emacs
help on how to get the info there.)


Norman
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs