runCommand :: (Proxy p) => Command -> Producer (StateP Options (ReaderP Settings p)) ClientDirective GHC.Ghc ExitCode
runCommand (CmdCheck real file) = do
    let status = respond . ClientLog "Check"
    setCurrentFile real file
    let noPhase = Nothing
    status "Unload previous target"
    lift $ GHC.setTargets []
    void $ lift $ GHC.load GHC.LoadAllTargets
    status "Load target"
    target <- lift $ GHC.guessTarget file noPhase
    lift $ GHC.setTargets [target]
    let handler err = GHC.printException err >> return GHC.Failed
    status "Compile target"
    flag <- lift $ GHC.handleSourceError handler (GHC.load GHC.LoadAllTargets)
    status "Check result"
    case flag of
        GHC.Succeeded -> return ExitSuccess
        GHC.Failed -> return $ ExitFailure 1
runCommand :: (Proxy p) => Command -> Producer (StateP Options (ReaderP Settings p)) ClientDirective GHC.Ghc ExitCode
runCommand (CmdCheck real file) = do
    let status = respond . ClientLog "Check"
    setCurrentFile real file
    let noPhase = Nothing
    status "Unload previous target"
    lift $ GHC.setTargets []
    void $ lift $ GHC.load GHC.LoadAllTargets
    status "Load target"
    target <- lift $ GHC.guessTarget file noPhase
    lift $ GHC.setTargets [target]
    let handler err = GHC.printException err >> return GHC.Failed
    status "Compile target"
    flag <- lift $ GHC.handleSourceError handler (GHC.load GHC.LoadAllTargets)
    status "Check result"
    case flag of
        GHC.Succeeded -> return ExitSuccess
        GHC.Failed -> return $ ExitFailure 1
runCommand (CmdCheck real file) = do
    let status = respond . ClientLog "Check"
    setCurrentFile real file
    let noPhase = Nothing
    status "Unload previous target"
    lift $ GHC.setTargets []
    void $ lift $ GHC.load GHC.LoadAllTargets
    status "Load target"
    target <- lift $ GHC.guessTarget file noPhase
    lift $ GHC.setTargets [target]
    let handler err = GHC.printException err >> return GHC.Failed
    status "Compile target"
    flag <- lift $ GHC.handleSourceError handler (GHC.load GHC.LoadAllTargets)
    status "Check result"
    case flag of
        GHC.Succeeded -> return ExitSuccess
        GHC.Failed -> return $ ExitFailure 1