HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleth-utilities-0.2.5.2Haskell2010

TH.RelativePaths

This module provides Template Haskell utilities for loading files based on paths relative to the root of your Cabal package.

Normally when building a cabal package, GHC is run with its current directory set at the package's root directory. This allows using relative paths to refer to files. However, this becomes problematic when you want to load modules from multiple projects, such as when using "stack ghci".

This solves the problem by getting the current module's filepath from TH via location. It then searches upwards in the directory tree for a .cabal file, and makes the provided path relative to the folder it's in.

Synopsis

Reads a file as a strict ByteString. The path is specified relative to the package's root directory, and addDependentfile is invoked on the target file.

Reads a file as a lazy ByteString. The path is specified relative to the package's root directory, and addDependentfile is invoked on the target file.

Reads a file as a strict Text. The path is specified relative to the package's root directory, and addDependentfile is invoked on the target file.

Reads a file as a lazy Text. The path is specified relative to the package's root directory, and addDependentfile is invoked on the target file.

Reads a file as a String. The path is specified relative to the package's root directory, and addDependentfile is invoked on the target file.