Does stack runghc not already respect package.yaml? I thought any Stack command would do so if run within a Stack project directory.
default-extensions are definitely not considered. I do not know if dependencies are because I do not even get that far in the compilation process thanks to default-extensions not being considered.
what do you mean by "interpret instead of compiling"?
I mean what ghci does as opposed to what ghc does.
Which part of what ghci does do you need? Afaiu (although I could be completely wrong, since I haven't read any direct topic on the subject), ghci still compiles code, but in a more specific way, and then gives you interactive access to that code (hence why you can't run anything from a module that doesn't compile, even if the particular thing you want to run is fine).
in any case, if you want to run with a ghci style, while also reading your project config, maybe writing something like a .ghci file with just main in it and then running stack ghci might work?
How do I make
stack run
interpret instead of compiling? Or alternatively, how do I makestack runghc app/Main.hs
respectpackage.yaml
?Does
stack runghc
not already respectpackage.yaml
? I thought any Stack command would do so if run within a Stack project directory.what do you mean by "interpret instead of compiling"?
stack runghc
is probably something liikestack exec -- runghc
so I'd assume it ignores project configGeorgi Lyubenov // googleson78 said:
I mean what
ghci
does as opposed to whatghc
does.bradrn said:
default-extensions
are definitely not considered. I do not know if dependencies are because I do not even get that far in the compilation process thanks todefault-extensions
not being considered.I’m not sure how this follows… e.g.
stack exec -- ghci
certainly respects project config insofar as it lets me use non-base
dependencies.rednaZ said:
Which part of what ghci does do you need? Afaiu (although I could be completely wrong, since I haven't read any direct topic on the subject), ghci still compiles code, but in a more specific way, and then gives you interactive access to that code (hence why you can't run anything from a module that doesn't compile, even if the particular thing you want to run is fine).
but what does byte-code mean? :sweat_smile:
I haven't heard of a VM for hs
unless it's something very specialised and the VM is the interpreter
https://gitlab.haskell.org/ghc/ghc/-/blob/master/rts/Interpreter.c
well, I guess I was wrong
but then why can't we load individual functions? :triumph:
in any case, if you want to run with a
ghci
style, while also reading your project config, maybe writing something like a.ghci
file with justmain
in it and then runningstack ghci
might work?Isn’t this pretty much exactly what
stack runghc
does?