Permalink
Browse files

Documentation only.

  • Loading branch information...
1 parent 91e23b7 commit ccfc6d0d053f10647c6f2c544954bfb89d15b098 @nominolo nominolo committed Mar 22, 2009
Showing with 28 additions and 10 deletions.
  1. +1 −1 src/Scion/Configure.hs
  2. +27 −9 src/Scion/Session.hs
@@ -95,7 +95,7 @@ configureCabalProject root_dir dist_dir extra_args = do
data ConfigException = ConfigException deriving (Show, Typeable)
instance Exception ConfigException
--- | Do the equivalent of "runghc Setup.hs <args>" using the GHC API.
+-- | Do the equivalent of @runghc Setup.hs <args>@ using the GHC API.
--
-- Instead of "runghc", this function uses the GHC API so that the correct
-- version of GHC and package database is used.
View
@@ -123,6 +123,7 @@ setWorkingDir home = do
message deafening $ "(Working directory changed.)"
workingDirectoryChanged
+------------------------------------------------------------------------
-- * Cabal Projects
-- | Try to open a Cabal project. The project must already be configured
@@ -185,6 +186,13 @@ currentCabalFile = do
Just f -> return f
Nothing -> liftIO $ throwIO $ NoCurrentCabalProject
+-- | Return all components of the specified Cabal file.
+--
+-- Throws:
+--
+-- * 'CannotOpenCabalProject' if an error occurs (e.g., .cabal file does
+-- not exist or could not be parsed.).
+--
cabalProjectComponents :: FilePath -- ^ The .cabal file
-> ScionM [Component]
cabalProjectComponents cabal_file = do
@@ -205,6 +213,15 @@ preprocessPackage dist_dir = do
liftIO $ initialBuildSteps dist_dir pd lbi V.normal knownSuffixHandlers
return ()
+-- | Return the current 'LocalBuildInfo'.
+--
+-- The 'LocalBuildInfo' is the result of configuring a Cabal project,
+-- therefore requires that we have a current Cabal project.
+--
+-- Throws:
+--
+-- * 'NoCurrentCabalProject' if there is no current Cabal project.
+--
getLocalBuildInfo :: ScionM LocalBuildInfo
getLocalBuildInfo =
gets localBuildInfo >>= \mb_lbi ->
@@ -213,12 +230,6 @@ getLocalBuildInfo =
--error "call openCabalProject before loadCabalProject"
Just lbi -> return lbi
-noLibError :: ScionM a
-noLibError = liftIO $ throwIO $ ComponentDoesNotExist Library
-
-noExeError :: String -> ScionM a
-noExeError = liftIO . throwIO . ComponentDoesNotExist . Executable
-
-- | Root directory of the current Cabal project.
--
-- Throws:
@@ -359,8 +370,8 @@ cabalProjectRoot = do
Just dir -> return dir
Nothing -> liftIO $ getCurrentDirectory
--- | Make the specified component the active one, i. e., set the DynFlags to
--- those specified for the given component.
+-- | Make the specified component the active one. Sets the DynFlags to
+-- those specified for the given component. Unloads the possible
--
-- Throws:
--
@@ -384,6 +395,14 @@ setActiveComponent comp = do
getActiveComponent :: ScionM (Maybe Component)
getActiveComponent = gets activeComponent
+-- ** Internal Utilities
+noLibError :: ScionM a
+noLibError = liftIO $ throwIO $ ComponentDoesNotExist Library
+
+noExeError :: String -> ScionM a
+noExeError = liftIO . throwIO . ComponentDoesNotExist . Executable
+
+------------------------------------------------------------------------
-- * Compilation
-- | Wrapper for 'GHC.load'.
@@ -480,7 +499,6 @@ setGHCVerbosity lvl = do
return ()
------------------------------------------------------------------------------
-
-- * Background Typechecking
-- | Takes an absolute path to a file and attempts to typecheck it.

0 comments on commit ccfc6d0

Please sign in to comment.