hie-bios-0.14.0: Set up a GHC API session

Safe Haskell | None
Language | Haskell2010

HIE.Bios.Cradle

Synopsis

- findCradle :: FilePath -> IO (Maybe FilePath)
- loadCradle :: LogAction IO (WithSeverity Log) -> FilePath -> IO (Cradle Void)
- loadImplicitCradle :: Show a => LogAction IO (WithSeverity Log) -> FilePath -> IO (Cradle a)
- yamlConfig :: FilePath -> MaybeT IO FilePath
- defaultCradle :: LogAction IO (WithSeverity Log) -> FilePath -> Cradle a
- isCabalCradle :: Cradle a -> Bool
- isStackCradle :: Cradle a -> Bool
- isDirectCradle :: Cradle a -> Bool
- isBiosCradle :: Cradle a -> Bool
- isNoneCradle :: Cradle a -> Bool
- isMultiCradle :: Cradle a -> Bool
- isDefaultCradle :: Cradle a -> Bool
- isOtherCradle :: Cradle a -> Bool
- getCradle :: Show a => LogAction IO (WithSeverity Log) -> (b -> CradleAction a) -> (CradleConfig b, FilePath) -> IO (Cradle a)
- readProcessWithOutputs :: Outputs -> LogAction IO (WithSeverity Log) -> FilePath -> CreateProcess -> IO (ExitCode, [String], [String], [(OutputName, Maybe [String])])
- readProcessWithCwd :: LogAction IO (WithSeverity Log) -> FilePath -> FilePath -> [String] -> String -> IO (CradleLoadResult String)
- makeCradleResult :: (ExitCode, [String], FilePath, [String]) -> [FilePath] -> CradleLoadResult ComponentOptions
- data CradleProjectConfig
  - = NoExplicitConfig
  - | ExplicitConfig FilePath

# Documentation

findCradle :: FilePath -> IO (Maybe FilePath) #

Given `root/foo/bar.hs`, return `root/hie.yaml`, or wherever the yaml file was found.

Note, `findCradle` used to **not** work for directories and required a Haskell file. This has been fixed since `0.14.0`. However, `loadCradle` and `loadImplicitCradle` still require a Haskell source file and won't work properly with a directory parameter.

loadCradle :: LogAction IO (WithSeverity Log) -> FilePath -> IO (Cradle Void) #

Given root/hie.yaml load the Cradle.

loadImplicitCradle :: Show a => LogAction IO (WithSeverity Log) -> FilePath -> IO (Cradle a) #

Given root/foo/bar.hs, load an implicit cradle

yamlConfig :: FilePath -> MaybeT IO FilePath #

defaultCradle :: LogAction IO (WithSeverity Log) -> FilePath -> Cradle a #

Default cradle has no special options, not very useful for loading modules.

isCabalCradle :: Cradle a -> Bool #

isStackCradle :: Cradle a -> Bool #

isDirectCradle :: Cradle a -> Bool #

isBiosCradle :: Cradle a -> Bool #

isNoneCradle :: Cradle a -> Bool #

isMultiCradle :: Cradle a -> Bool #

isDefaultCradle :: Cradle a -> Bool #

isOtherCradle :: Cradle a -> Bool #

getCradle :: Show a => LogAction IO (WithSeverity Log) -> (b -> CradleAction a) -> (CradleConfig b, FilePath) -> IO (Cradle a) #

readProcessWithOutputs #

Arguments

:: Outputs | Names of the outputs produced by this process
-> LogAction IO (WithSeverity Log) | Output of the process is emitted as logs.
-> FilePath | Working directory. Process is executed in this directory.
-> CreateProcess | Parameters for the process to be executed.
-> IO (ExitCode, [String], [String], [(OutputName, Maybe [String])]) |

Call a given process with temp files for the process to write to. * The process can discover the temp files paths by reading the environment. * The contents of the temp files are returned by this function, if any. * The logging function is called every time the process emits anything to stdout or stderr. it can be used to report progress of the process to a user. * The process is executed in the given directory.

readProcessWithCwd :: LogAction IO (WithSeverity Log) -> FilePath -> FilePath -> [String] -> String -> IO (CradleLoadResult String) #

Wrapper around `readCreateProcess` that sets the working directory and clears the environment, suitable for invoking cabal/stack and raw ghc commands.

makeCradleResult :: (ExitCode, [String], FilePath, [String]) -> [FilePath] -> CradleLoadResult ComponentOptions #

Cradle project configuration types

data CradleProjectConfig #

Explicit data-type for project configuration location. It is basically a `Maybe` type, but helps to document the API and helps to avoid incorrect usage.

Constructors

NoExplicitConfig |
ExplicitConfig FilePath |

#### Instances

Instances details

Eq CradleProjectConfig # |
Instance details Defined in HIE.Bios.Cradle Methods (==) :: CradleProjectConfig -> CradleProjectConfig -> Bool # (/=) :: CradleProjectConfig -> CradleProjectConfig -> Bool #