setAllCabalImportDirs :: (Proxy p) => FilePath -> Producer p ClientDirective GHC.Ghc ()
setAllCabalImportDirs cabal = runIdentityP $ do
  config <- lift $ GHC.liftIO $ readFile cabal
  case parseCabalConfig config of
    (ParseFailed err) -> do
      respond $ ClientLog "setAllCabalImportDirs" $ "Parsing failed: " ++ show err
      return ()
    (ParseOk _ r) -> do
      let dirs = allBuildInfo r >>= hsSourceDirs
      respond $ ClientLog "setAllCabalImportDirs" $ "Added directories: " ++ show dirs
      dynFlags <- lift GHC.getSessionDynFlags
      (finalDynFlags,_,_) <- lift $ GHC.parseDynamicFlags dynFlags (map (GHC.noLoc . ("-i" ++)) dirs)
      void $ handleGHCException $ void $ GHC.setSessionDynFlags finalDynFlags
setAllCabalImportDirs :: (Proxy p) => FilePath -> Producer p ClientDirective GHC.Ghc ()
setAllCabalImportDirs cabal = runIdentityP $ do
  config <- lift $ GHC.liftIO $ readFile cabal
  case parseCabalConfig config of
    (ParseFailed err) -> do
      respond $ ClientLog "setAllCabalImportDirs" $ "Parsing failed: " ++ show err
      return ()
    (ParseOk _ r) -> do
      let dirs = allBuildInfo r >>= hsSourceDirs
      respond $ ClientLog "setAllCabalImportDirs" $ "Added directories: " ++ show dirs
      dynFlags <- lift GHC.getSessionDynFlags
      (finalDynFlags,_,_) <- lift $ GHC.parseDynamicFlags dynFlags (map (GHC.noLoc . ("-i" ++)) dirs)
      void $ handleGHCException $ void $ GHC.setSessionDynFlags finalDynFlags
setAllCabalImportDirs cabal = runIdentityP $ do
  config <- lift $ GHC.liftIO $ readFile cabal
  case parseCabalConfig config of
    (ParseFailed err) -> do
      respond $ ClientLog "setAllCabalImportDirs" $ "Parsing failed: " ++ show err
      return ()
    (ParseOk _ r) -> do
      let dirs = allBuildInfo r >>= hsSourceDirs
      respond $ ClientLog "setAllCabalImportDirs" $ "Added directories: " ++ show dirs
      dynFlags <- lift GHC.getSessionDynFlags
      (finalDynFlags,_,_) <- lift $ GHC.parseDynamicFlags dynFlags (map (GHC.noLoc . ("-i" ++)) dirs)
      void $ handleGHCException $ void $ GHC.setSessionDynFlags finalDynFlags