A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/commercialhaskell/stack/issues/5421 below:

`stack repl subpackage` compile time cwd is different from `stack build subpackage` one · Issue #5421 · commercialhaskell/stack · GitHub

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
  1. Create a simple stack project with a main package with an exe and a subpackage with a lib
  2. 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

  1. Run command stack run and observe cwd is /path/to/main/package/subpackage
  2. Run command stack repl subpackage or stack repl and 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

Vlix, michaelpj, AlistairB and fendor


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4