-hscCompileInteractive hsc_env mod_summary =
- hscMkCompiler norecompInteractive batchMsg
- frontend backend
- hsc_env mod_summary
- where backend inp = hscSimplify inp >>= hscNormalIface >>= hscIgnoreIface >>= hscInteractive
- frontend = case ms_hsc_src mod_summary of
- ExtCoreFile -> hscCoreFrontEnd
- HsSrcFile -> hscFileFrontEnd
- HsBootFile -> panic bootErrorMsg
- bootErrorMsg = "Compiling a HsBootFile to bytecode doesn't make sense. " ++
- "Use 'hscCompileBatch' instead."
+hscCompileInteractive
+ = hscCompiler norecompInteractive batchMsg backend boot_backend
+ where
+ backend inp = hscSimplify inp >>= hscNormalIface >>= hscIgnoreIface >>= hscInteractive
+ boot_backend = panic "hscCompileInteractive: can't do boot files here"
+
+hscCompiler
+ :: NoRecomp result -- No recomp necessary
+ -> (Maybe (Int,Int) -> Bool -> Comp ()) -- Message callback
+ -> (ModGuts -> Comp result) -- Compile normal file
+ -> (ModGuts -> Comp result) -- Compile boot file
+ -> Compiler result
+hscCompiler norecomp msg nonBootComp bootComp hsc_env mod_summary =
+ hscMkCompiler norecomp msg frontend backend hsc_env mod_summary
+ where
+ (frontend,backend)
+ = case ms_hsc_src mod_summary of
+ ExtCoreFile -> (hscCoreFrontEnd, nonBootComp)
+ HsSrcFile -> (hscFileFrontEnd, nonBootComp)
+ HsBootFile -> (hscFileFrontEnd, bootComp)