Migrate the remaining parts of the exposed API to GhcMod a

This commit is contained in:
Daniel Gröber
2014-07-11 03:10:37 +02:00
parent dc5ba6d00d
commit 4b6a687bc1
27 changed files with 180 additions and 276 deletions

View File

@@ -13,6 +13,7 @@ module Language.Haskell.GhcMod.Monad (
, withErrorHandler
, toGhcMod
, options
, cradle
, module Control.Monad.Reader.Class
, module Control.Monad.Writer.Class
, module Control.Monad.State.Class
@@ -103,11 +104,11 @@ runGhcMod' r s a = do
newGhcModEnv :: Options -> FilePath -> IO GhcModEnv
newGhcModEnv opt dir = do
session <- newIORef (error "empty session")
cradle <- findCradle' dir
c <- findCradle' dir
return GhcModEnv {
gmGhcSession = session
, gmOptions = opt
, gmCradle = cradle
, gmCradle = c
}
runGhcMod :: Options -> GhcMod a -> IO a
@@ -142,6 +143,9 @@ toGhcMod a = do
options :: GhcMod Options
options = gmOptions <$> ask
cradle :: GhcMod Cradle
cradle = gmCradle <$> ask
instance MonadBase IO GhcMod where
liftBase = GhcMod . liftBase