-
Notifications
You must be signed in to change notification settings - Fork 847
Closed
Description
General summary/comments (optional)
The current working dir at compile time is different between stack build and stack repl. It likely makes template haskell io computations relying in cwd fail, cause the relative file or directory usually does not exist.
This in turn makes that code not usable in a ide (hls, ghcide) that uses hie-bios to manage ghc session, as hie-bios uses stack repl underneath for stack projects.
(original issue haskell/haskell-language-server#481)
Steps to reproduce
- Create a simple stack project with a main package with an exe and a subpackage with a lib
- Create in the subpackage lib a module with
import System.Directory
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
cwd :: FilePath
cwd = $$(runIO getCurrentDirectory >>= \d-> fmap TExp (lift (d :: FilePath)))and in the main package an executable with
main = print cwd- Run command
stack runand observe cwd is/path/to/main/package/subpackage - Run command
stack repl subpackageorstack repland observe cwd evaluation gives us/path/to/main/package
Expected
Both paths should be equal.
Actual
stack build uses the subpackage path and stack repl the main package one
Stack version
$ stack --version
Version 2.5.1 x86_64 hpack-0.33.0
Method of installation
- Official binary, downloaded from stackage.org or fpcomplete's package repository
Vlix, michaelpj, AlistairB and fendor
Metadata
Metadata
Assignees
Labels
No labels