use Hadrian to see if compiler compiles?

2022-01-24 Thread Norman Ramsey
I'm currently doing some refactoring of the GHC sources, which
involves moving definitions between modules.  As a sanity check
I want to compile often, so if I've broken anything (or have inadvertently
created circular imports) I can find out quickly.  I'm currently using

  ./hadrian/build -j

but I really don't need to build libraries or a stage 2 compiler.
I tried looking over `./hadrian/build --help`, but I'm not confident
that I understand what's there.  My best guess is

  ./hadrian/build -j stage0:lib:ghc

Would that accomplish my goal?


Norman


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


Re: use Hadrian to see if compiler compiles?

2022-01-24 Thread Richard Eisenberg
My recommendation: ./hadrian/ghci. The first time you run it, it may spin for a 
little while, but it will eventually deliver you to a GHCi prompt, with all of 
GHC loaded. (You can e.g. `:type splitTyConApp_maybe`, after `import 
GHC.Core.Type`.) At that point, :reload will be your dear friend. That's what I 
do when I'm doing e.g. module reorganization and care much more about "does it 
compile" than "does it work".

Richard

> On Jan 24, 2022, at 5:02 PM, Norman Ramsey  wrote:
> 
> I'm currently doing some refactoring of the GHC sources, which
> involves moving definitions between modules.  As a sanity check
> I want to compile often, so if I've broken anything (or have inadvertently
> created circular imports) I can find out quickly.  I'm currently using
> 
>  ./hadrian/build -j
> 
> but I really don't need to build libraries or a stage 2 compiler.
> I tried looking over `./hadrian/build --help`, but I'm not confident
> that I understand what's there.  My best guess is
> 
>  ./hadrian/build -j stage0:lib:ghc
> 
> Would that accomplish my goal?
> 
> 
> 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: use Hadrian to see if compiler compiles?

2022-01-25 Thread Norman Ramsey
 > My recommendation: ./hadrian/ghci. The first time you run it, it may spin
 > for a little while, but it will eventually deliver you to a GHCi prompt,
 > with all of GHC loaded. (You can e.g. `:type splitTyConApp_maybe`, after
 > `import GHC.Core.Type`.) At that point, :reload will be your dear friend.
 > That's what I do when I'm doing e.g. module reorganization and care much
 > more about "does it compile" than "does it work".

Cool!  Supposing I wanted to run just a little code that uses the GHC API.
Would there be a way to load the Prelude and similar things into that GHCi,
so it could know about Bool and IO and such things?


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


Re: use Hadrian to see if compiler compiles?

2022-01-25 Thread Richard Eisenberg


> On Jan 25, 2022, at 2:15 PM, Norman Ramsey  wrote:
> 
> Cool!  Supposing I wanted to run just a little code that uses the GHC API.
> Would there be a way to load the Prelude and similar things into that GHCi,
> so it could know about Bool and IO and such things?


The GHCi that runs is your system's GHCi, so it has access to everything 
installed in your bootstrap GHC. However, I don't see a connection between your 
second sentence and your last sentence: that is, the GHCi will certainly know 
about Bool and IO, but I don't see how that helps with the GHC API. I have no 
idea how you would use the GHC API in this mode. My advice would be to use this 
trick to get quick feedback about compilation, and then once GHC compiles, use 
other more well-worn techniques to build it and test your application.

Richard

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