From 735b80d0cc648f93fd926aab6914c9f3c43ab152 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Tue, 23 Sep 2014 14:49:13 +0900 Subject: [PATCH] exporting setupConfigFile. --- Language/Haskell/GhcMod/CabalConfig.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Language/Haskell/GhcMod/CabalConfig.hs b/Language/Haskell/GhcMod/CabalConfig.hs index 6a03e26..5ea6ead 100644 --- a/Language/Haskell/GhcMod/CabalConfig.hs +++ b/Language/Haskell/GhcMod/CabalConfig.hs @@ -6,6 +6,7 @@ module Language.Haskell.GhcMod.CabalConfig ( CabalConfig , cabalConfigDependencies , cabalConfigFlags + , setupConfigFile ) where import Language.Haskell.GhcMod.Error @@ -53,20 +54,23 @@ type CabalConfig = String getConfig :: (IOish m, MonadError GhcModError m) => Cradle -> m CabalConfig -getConfig cradle = liftIO (readFile path) `tryFix` \_ -> +getConfig cradle = liftIO (readFile file) `tryFix` \_ -> configure `modifyError'` GMECabalConfigure where + file = setupConfigFile cradle prjDir = cradleRootDir cradle - path = prjDir configPath configure :: (IOish m, MonadError GhcModError m) => m () configure = withDirectory_ prjDir $ readProcess' "cabal" ["configure"] >> return () +setupConfigFile :: Cradle -> FilePath +setupConfigFile crdl = cradleRootDir crdl setupConfigPath + -- | Path to 'LocalBuildInfo' file, usually @dist/setup-config@ -configPath :: FilePath -configPath = localBuildInfoFile defaultDistPref +setupConfigPath :: FilePath +setupConfigPath = localBuildInfoFile defaultDistPref -- | Get list of 'Package's needed by all components of the current package cabalConfigDependencies :: (IOish m, MonadError GhcModError m)