module HIE.Bios.Flags (getCompilerOptions, getCompilerOptionsWithLogger, LoggingFunction) where

import HIE.Bios.Types
import HIE.Bios.Internal.Log


-- | Initialize the 'DynFlags' relating to the compilation of a single
-- file or GHC session according to the provided 'Cradle'.
getCompilerOptions ::
    FilePath -- The file we are loading it because of
    -> Cradle a
    -> IO (CradleLoadResult ComponentOptions)
getCompilerOptions :: FilePath -> Cradle a -> IO (CradleLoadResult ComponentOptions)
getCompilerOptions =
  LoggingFunction
-> FilePath -> Cradle a -> IO (CradleLoadResult ComponentOptions)
forall a.
LoggingFunction
-> FilePath -> Cradle a -> IO (CradleLoadResult ComponentOptions)
getCompilerOptionsWithLogger LoggingFunction
forall (m :: * -> *). MonadIO m => FilePath -> m ()
logm

getCompilerOptionsWithLogger ::
  LoggingFunction
  -> FilePath
  -> Cradle a
  -> IO (CradleLoadResult ComponentOptions)
getCompilerOptionsWithLogger :: LoggingFunction
-> FilePath -> Cradle a -> IO (CradleLoadResult ComponentOptions)
getCompilerOptionsWithLogger LoggingFunction
l FilePath
fp Cradle a
cradle =
  CradleAction a
-> LoggingFunction
-> FilePath
-> IO (CradleLoadResult ComponentOptions)
forall a.
CradleAction a
-> LoggingFunction
-> FilePath
-> IO (CradleLoadResult ComponentOptions)
runCradle (Cradle a -> CradleAction a
forall a. Cradle a -> CradleAction a
cradleOptsProg Cradle a
cradle) LoggingFunction
l FilePath
fp


----------------------------------------------------------------