module HIE.Bios.Flags (getCompilerOptions) where

import HIE.Bios.Types

import qualified Colog.Core as L
import Data.Text.Prettyprint.Doc

-- | Initialize the 'DynFlags' relating to the compilation of a single
-- file or GHC session according to the provided 'Cradle'.
getCompilerOptions
  :: L.LogAction IO (L.WithSeverity Log)
  -> FilePath -- The file we are loading it because of
  -> Cradle a
  -> IO (CradleLoadResult ComponentOptions)
getCompilerOptions :: LogAction IO (WithSeverity Log)
-> FilePath -> Cradle a -> IO (CradleLoadResult ComponentOptions)
getCompilerOptions LogAction IO (WithSeverity Log)
l FilePath
fp Cradle a
cradle = CradleAction a
-> LogAction IO (WithSeverity Log)
-> FilePath
-> IO (CradleLoadResult ComponentOptions)
forall a.
CradleAction a
-> LogAction IO (WithSeverity Log)
-> FilePath
-> IO (CradleLoadResult ComponentOptions)
runCradle (Cradle a -> CradleAction a
forall a. Cradle a -> CradleAction a
cradleOptsProg Cradle a
cradle) LogAction IO (WithSeverity Log)
l FilePath
fp