From 782da60d0c7f00d2710a5c15ad7e8ffa51d93df1 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Wed, 26 Mar 2014 12:09:02 +0900 Subject: [PATCH] adding docs. --- Language/Haskell/GhcMod/Browse.hs | 1 + Language/Haskell/GhcMod/ErrMsg.hs | 1 + Language/Haskell/GhcMod/GHCApi.hs | 2 ++ Language/Haskell/GhcMod/Internal.hs | 9 ++++----- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Language/Haskell/GhcMod/Browse.hs b/Language/Haskell/GhcMod/Browse.hs index 0078e3f..b07c7df 100644 --- a/Language/Haskell/GhcMod/Browse.hs +++ b/Language/Haskell/GhcMod/Browse.hs @@ -133,6 +133,7 @@ showOutputable dflag = unwords . lines . showUnqualifiedPage dflag . ppr ---------------------------------------------------------------- +-- | Browsing all functions in all system/user modules. browseAll :: DynFlags -> Ghc [(String,String)] browseAll dflag = do ms <- packageDbModules True diff --git a/Language/Haskell/GhcMod/ErrMsg.hs b/Language/Haskell/GhcMod/ErrMsg.hs index f0ee794..5cba6fb 100644 --- a/Language/Haskell/GhcMod/ErrMsg.hs +++ b/Language/Haskell/GhcMod/ErrMsg.hs @@ -58,6 +58,7 @@ setLogger True df ls = do ---------------------------------------------------------------- +-- | Converting 'SourceError' to 'String'. handleErrMsg :: LineSeparator -> SourceError -> Ghc [String] handleErrMsg ls err = do dflag <- getSessionDynFlags diff --git a/Language/Haskell/GhcMod/GHCApi.hs b/Language/Haskell/GhcMod/GHCApi.hs index 6830671..99cb6ea 100644 --- a/Language/Haskell/GhcMod/GHCApi.hs +++ b/Language/Haskell/GhcMod/GHCApi.hs @@ -31,6 +31,7 @@ import System.Process ---------------------------------------------------------------- +-- | Obtaining the directory for system libraries. getSystemLibDir :: IO (Maybe FilePath) getSystemLibDir = do res <- readProcess "ghc" ["--print-libdir"] [] @@ -159,6 +160,7 @@ setTargetFiles files = do targets <- forM files $ \file -> guessTarget file Nothing setTargets targets +-- | Adding the files to the targets. addTargetFiles :: (GhcMonad m) => [FilePath] -> m () addTargetFiles [] = error "ghc-mod: addTargetFiles: No target files given" addTargetFiles files = do diff --git a/Language/Haskell/GhcMod/Internal.hs b/Language/Haskell/GhcMod/Internal.hs index 74bf262..f1d674e 100644 --- a/Language/Haskell/GhcMod/Internal.hs +++ b/Language/Haskell/GhcMod/Internal.hs @@ -14,24 +14,23 @@ module Language.Haskell.GhcMod.Internal ( , cabalDependPackages , cabalSourceDirs , cabalAllTargets - -- * Getting 'DynFlags' + -- * IO + , getSystemLibDir , getDynamicFlags -- * Initializing 'DynFlags' , initializeFlags , initializeFlagsWithCradle - -- * 'GhcMonad' + -- * 'Ghc' Monad , setTargetFiles , addTargetFiles , handleErrMsg + , browseAll -- * 'Ghc' Choice , (||>) , goNext , runAnyOne -- * 'GhcMonad' Choice , (|||>) - -- * GHC - , getSystemLibDir - , browseAll ) where import Language.Haskell.GhcMod.Browse