Skip to content

Commit

Permalink
Apply IdeResult (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurkenglas authored and cocreature committed Jan 28, 2020
1 parent cb28287 commit e392c49
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Development/IDE/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Development.IDE.Core.Compile

import Development.IDE.Core.RuleTypes
import Development.IDE.Core.Preprocessor
import Development.IDE.Core.Shake
import Development.IDE.GHC.Error
import Development.IDE.GHC.Warnings
import Development.IDE.Types.Diagnostics
Expand Down Expand Up @@ -67,7 +68,7 @@ parseModule
-> HscEnv
-> FilePath
-> Maybe SB.StringBuffer
-> IO ([FileDiagnostic], Maybe (StringBuffer, ParsedModule))
-> IO (IdeResult (StringBuffer, ParsedModule))
parseModule IdeOptions{..} env filename mbContents =
fmap (either (, Nothing) id) $
runGhcEnv env $ runExceptT $ do
Expand Down Expand Up @@ -95,7 +96,7 @@ typecheckModule
-> HscEnv
-> [TcModuleResult]
-> ParsedModule
-> IO ([FileDiagnostic], Maybe TcModuleResult)
-> IO (IdeResult TcModuleResult)
typecheckModule (IdeDefer defer) packageState deps pm =
let demoteIfDefer = if defer then demoteTypeErrorsToWarnings else id
in
Expand Down Expand Up @@ -129,7 +130,7 @@ compileModule
:: HscEnv
-> [TcModuleResult]
-> TcModuleResult
-> IO ([FileDiagnostic], Maybe (SafeHaskellMode, CgGuts, ModDetails))
-> IO (IdeResult (SafeHaskellMode, CgGuts, ModDetails))
compileModule packageState deps tmr =
fmap (either (, Nothing) (second Just)) $
runGhcEnv packageState $
Expand All @@ -148,7 +149,7 @@ compileModule packageState deps tmr =
(guts, details) <- liftIO $ tidyProgram session desugar
return (map snd warnings, (mg_safe_haskell desugar, guts, details))

generateByteCode :: HscEnv -> [TcModuleResult] -> TcModuleResult -> CgGuts -> IO ([FileDiagnostic], Maybe Linkable)
generateByteCode :: HscEnv -> [TcModuleResult] -> TcModuleResult -> CgGuts -> IO (IdeResult Linkable)
generateByteCode hscEnv deps tmr guts =
fmap (either (, Nothing) (second Just)) $
runGhcEnv hscEnv $
Expand Down

0 comments on commit e392c49

Please sign in to comment.