haskell-docs 4.1.4 → 4.1.5
raw patch · 6 files changed
+24/−15 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Haskell.Docs.Types: identDocIdentifier :: IdentDoc -> !Identifier
+ Haskell.Docs.Types: identDocModuleName :: IdentDoc -> !ModuleName
- Haskell.Docs.Types: IdentDoc :: !PackageIdentifier -> !(Doc String) -> !(Maybe Id) -> !(Maybe [(Int, Doc String)]) -> IdentDoc
+ Haskell.Docs.Types: IdentDoc :: !PackageIdentifier -> !Identifier -> !ModuleName -> !(Doc String) -> !(Maybe Id) -> !(Maybe [(Int, Doc String)]) -> IdentDoc
Files
- haskell-docs.cabal +1/−1
- src/Haskell/Docs.hs +2/−1
- src/Haskell/Docs/Formatting.hs +5/−5
- src/Haskell/Docs/Haddock.hs +2/−0
- src/Haskell/Docs/Types.hs +2/−0
- src/main/Main.hs +12/−8
haskell-docs.cabal view
@@ -1,5 +1,5 @@ name: haskell-docs-version: 4.1.4+version: 4.1.5 synopsis: A program to find and display the docs and type of a name description: Given a module name and a name, or just a name, it will find and display the documentation of that name.
src/Haskell/Docs.hs view
@@ -14,6 +14,7 @@ import Haskell.Docs.Haddock import Haskell.Docs.Types +import Control.Exception import Control.Monad import Data.List import Data.Ord@@ -32,7 +33,7 @@ do (result,printPkg,printModule) <- search case result of Left err ->- error (show err)+ throw err Right (sortBy (comparing identDocPackageName) -> docs) -> if ss then printSexp (nub docs)
src/Haskell/Docs/Formatting.hs view
@@ -29,20 +29,20 @@ -> Ghc () printIdentDoc True _ _ idoc = do d <- getSessionDynFlags- maybe (return ())- (\i -> liftIO (putStrLn (showppr d (moduleName (nameModule (getName i))))))- (identDocIdent idoc)+ maybe (liftIO (putStrLn (showppr d (identDocModuleName idoc))))+ (\i -> liftIO (putStrLn (showppr d (moduleName (nameModule (getName i))))))+ (identDocIdent idoc) printIdentDoc _ printPkg printModule idoc = do d <- getSessionDynFlags when printPkg (liftIO (putStrLn ("Package: " ++ showPackageName (identDocPackageName idoc)))) when printModule- (maybe (return ())+ (maybe (liftIO (putStrLn ("Module: " ++ showppr d (identDocModuleName idoc)))) (\i -> liftIO (putStrLn ("Module: " ++ showppr d (moduleName (nameModule (getName i)))))) (identDocIdent idoc)) case identDocIdent idoc of- Nothing -> return ()+ Nothing -> liftIO (putStrLn (unIdentifier (identDocIdentifier idoc))) Just i -> liftIO (putStrLn (showppr d i ++ " :: " ++ showppr d (idType i))) liftIO (putStrLn (formatDoc (identDocDocs idoc))) case identDocArgDocs idoc of
src/Haskell/Docs/Haddock.hs view
@@ -142,6 +142,8 @@ return (Right [IdentDoc (sourcePackageId package)+ name+ (moduleName (instMod interface)) d mi margs])
src/Haskell/Docs/Types.hs view
@@ -27,6 +27,8 @@ -- | Identier documentation along with argument docs and identifiers. data IdentDoc = IdentDoc { identDocPackageName :: !PackageIdentifier+ , identDocIdentifier :: !Identifier+ , identDocModuleName :: !ModuleName , identDocDocs :: !(Doc String) , identDocIdent :: !(Maybe Id) , identDocArgDocs :: !(Maybe [(Int, Doc String)])
src/main/Main.hs view
@@ -11,6 +11,7 @@ import Control.Exception import Control.Exception (IOException) import qualified Control.Exception as E+import Data.Typeable import GHC import GhcMonad import System.Environment@@ -25,7 +26,7 @@ -- | Do the printing. app :: [String] -> IO ()-app (extract -> (gs,ms,as,ss)) =+app (extract -> x@(gs,ms,as,ss)) = withInitializedPackages gs (catchErrors@@ -62,17 +63,20 @@ go (gs,ms,as,ss) ("--modules":ys) = go (gs,True,as,ss) ys go (gs,ms,as,ss) ("--sexp":ys) = go (gs,ms,as,True) ys go (gs,ms,as,ss) (y:ys) = go (gs,ms,y:as,ss) ys- go (gs,ms,as,ss) [] = (gs,ms,as,ss)+ go (gs,ms,as,ss) [] = (gs,ms,reverse as,ss) -- | Catch errors and print 'em out. catchErrors :: Ghc () -> Ghc () catchErrors m =- gcatch (gcatch m- (\x ->- do bail (printEx x)- liftIO exitFailure))- (\(e::SomeException) ->- bail (show e))+ gcatch+ m+ (\(SomeException e) ->+ case cast e of+ Just ex ->+ do bail (printEx ex)+ liftIO exitFailure+ Nothing ->+ bail ("Exception: " ++ show e ++ " :: " ++ show (typeOf e) ++ "")) -- | Print an error and bail out. bail :: String -> Ghc ()