Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- initSession :: GhcMonad m => ComponentOptions -> m [Target]
- getRuntimeGhcLibDir :: Cradle a -> IO (CradleLoadResult FilePath)
- getRuntimeGhcVersion :: Cradle a -> IO (CradleLoadResult String)
- makeDynFlagsAbsolute :: FilePath -> DynFlags -> DynFlags
- makeTargetsAbsolute :: FilePath -> [Target] -> [Target]
- getCacheDir :: FilePath -> IO FilePath
- addCmdOpts :: GhcMonad m => [String] -> DynFlags -> m (DynFlags, [Target])
Documentation
initSession :: GhcMonad m => ComponentOptions -> m [Target] Source #
Start a GHC session and set some sensible options for tooling to use. Creates a folder in the cache directory to cache interface files to make reloading faster.
getRuntimeGhcLibDir :: Cradle a -> IO (CradleLoadResult FilePath) Source #
getRuntimeGhcLibDir cradle
will give you the ghc libDir:
do not use runGhcCmd
directly.
This will also perform additional lookups and fallbacks to try and get a
reliable library directory.
It tries this specific order of paths:
- the
NIX_GHC_LIBDIR
if it is set - calling
runCradleGhc
on the provided cradle
getRuntimeGhcVersion :: Cradle a -> IO (CradleLoadResult String) Source #
Gets the version of ghc used when compiling the cradle. It is based off of
getRuntimeGhcLibDir
. If it can't work out the verison reliably, it will
return a CradleError
getCacheDir :: FilePath -> IO FilePath Source #
Back in the day we used to clear the cache at the start of each session, however, it's not really necessary as 1. There is one cache dir for any change in options. 2. Interface files are resistent to bad option changes anyway.
clearInterfaceCache :: FilePath -> IO () clearInterfaceCache fp = do cd <- getCacheDir fp res <- doesPathExist cd when res (removeDirectoryRecursive cd)
Prepends the cache directory used by the library to the supplied file path. It tries to use the path under the environment variable `$HIE_BIOS_CACHE_DIR` and falls back to the standard `$XDG_CACHE_HOME/hie-bios` if the former is not set