@@ -167,7 +167,7 @@ run root interpretPaths = do
167167 withGhciScript pkgs $ \dotGhciPath -> do
168168 assets <- findProjectAssets root
169169 putLog Debug $ "Assets impurely loaded from: " <> assets
170− ghciArgs <- getGhciSessionSettings pkgs root
170+ ghciArgs <- getGhciSessionSettings pkgs root True
171171 freePort <- getFreePort
172172 runGhcid root True (ghciArgs <> mkGhciScriptArg dotGhciPath) pkgs $ Just $ unwords
173173 [ "Obelisk.Run.run"
@@ -180,21 +180,21 @@ run root interpretPaths = do
180180runRepl :: MonadObelisk m => FilePath -> PathTree Interpret -> m ()
181181runRepl root interpretPaths = do
182182 pkgs <- getParsedLocalPkgs root interpretPaths
183− ghciArgs <- getGhciSessionSettings pkgs "."
183+ ghciArgs <- getGhciSessionSettings pkgs "." True
184184 withGhciScript pkgs $ \dotGhciPath ->
185185 runGhciRepl root pkgs (ghciArgs <> mkGhciScriptArg dotGhciPath)
186186
187187runWatch :: MonadObelisk m => FilePath -> PathTree Interpret -> m ()
188188runWatch root interpretPaths = do
189189 pkgs <- getParsedLocalPkgs root interpretPaths
190− ghciArgs <- getGhciSessionSettings pkgs root
190+ ghciArgs <- getGhciSessionSettings pkgs root True
191191 withGhciScript pkgs $ \dotGhciPath ->
192192 runGhcid root True (ghciArgs <> mkGhciScriptArg dotGhciPath) pkgs Nothing
193193
194−exportGhciConfig :: MonadObelisk m => FilePath -> PathTree Interpret -> m [String]
195−exportGhciConfig root interpretPaths = do
194+exportGhciConfig :: MonadObelisk m => Bool -> FilePath -> PathTree Interpret -> m [String]
195+exportGhciConfig useRelativePaths root interpretPaths = do
196196 pkgs <- getParsedLocalPkgs root interpretPaths
197− getGhciSessionSettings pkgs "."
197+ getGhciSessionSettings pkgs "." useRelativePaths
198198
199199nixShellForInterpretPaths :: MonadObelisk m => Bool -> String -> FilePath -> PathTree Interpret -> Maybe String -> m ()
200200nixShellForInterpretPaths isPure shell root interpretPaths cmd = do
@@ -427,8 +427,9 @@ getGhciSessionSettings
427427 :: (MonadObelisk m, Foldable f)
428428 => f CabalPackageInfo -- ^ List of packages to load into ghci
429429 -> FilePath -- ^ All paths will be relative to this path
430+ -> Bool -- ^ Use relative paths
430431 -> m [String]
431−getGhciSessionSettings (toList -> packageInfos) pathBase = do
432+getGhciSessionSettings (toList -> packageInfos) pathBase useRelativePaths = do
432433 -- N.B. ghci settings do NOT support escaping in any way. To minimize the likelihood that
433434 -- paths-with-spaces ruin our day, we first canonicalize everything, and then relativize
434435 -- all paths to 'pathBase'.
@@ -438,13 +439,15 @@ getGhciSessionSettings (toList -> packageInfos) pathBase = do
438439 (pkgFiles, pkgSrcPaths :: [NonEmpty FilePath]) <- fmap unzip $ liftIO $ for packageInfos $ \pkg -> do
439440 canonicalSrcDirs <- traverse canonicalizePath $ (_cabalPackageInfo_packageRoot pkg </>) <$> _cabalPackageInfo_sourceDirs pkg
440441 canonicalPkgFile <- canonicalizePath $ _cabalPackageInfo_packageFile pkg
441− pure (canonicalPkgFile `relativeTo` canonicalPathBase, (`relativeTo` canonicalPathBase) <$> canonicalSrcDirs)
442+ pure (canonicalPkgFile `relativeTo'` canonicalPathBase, (`relativeTo'` canonicalPathBase) <$> canonicalSrcDirs)
442443
443444 pure
444445 $ baseGhciOptions
445446 <> ["-F", "-pgmF", selfExe, "-optF", preprocessorIdentifier]
446447 <> concatMap (\p -> ["-optF", p]) pkgFiles
447448 <> [ "-i" <> intercalate ":" (concatMap toList pkgSrcPaths) ]
449+ where
450+ relativeTo' = if useRelativePaths then relativeTo else const
448451
449452baseGhciOptions :: [String]
450453baseGhciOptions =
@@ -537,4 +540,4 @@ relativeTo dir base
537540 $ zipDefaultWith Nothing Nothing (,)
538541 (map Just $ splitDirectories base)
539542 (map Just $ splitDirectories dir)
540− where collapse = foldr (</>) ""
543+ where collapse = foldr (</>) ""