haskell-docs 0.1.1.0 → 0.2.0.0
raw patch · 2 files changed
+15/−2 lines, 2 files
Files
- haskell-docs.cabal +2/−2
- src/Main.hs +13/−0
haskell-docs.cabal view
@@ -1,5 +1,5 @@ name: haskell-docs-version: 0.1.1.0+version: 0.2.0.0 synopsis: A program to find and display the docs of a name from a given module. description: Given a module name and a name, it will find and display@@ -44,7 +44,7 @@ . /CONTRIBUTION AND ISSUES/ .- Issues/ideas/contributions please make a Github issue: <http://github.com/chrisdone/haskell-docs/issues>+ Issues\/ideas\/contributions please make a Github issue: <http://github.com/chrisdone/haskell-docs/issues> . license: BSD3 license-file: LICENSE
src/Main.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS -Wall -fno-warn-orphans #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE CPP #-} -- | Lookup the documentation of a name in a module (and in a specific -- package in the case of ambiguity).@@ -40,7 +41,11 @@ import Data.Map (Map) import qualified Data.Map as M import Documentation.Haddock+#if __GLASGOW_HASKELL__ < 706 import DynFlags (defaultLogAction)+#else+import DynFlags (defaultFlushOut, defaultFatalMessager)+#endif import GHC hiding (flags, verbosity) import GHC.Paths (libdir) import Module@@ -174,7 +179,11 @@ go (DocOrderedList i) = unlines (zipWith (\i x -> show i ++ ". " ++ go x) [1..] i) go (DocDefList xs) = unlines (map (\(i,x) -> go i ++ ". " ++ go x) xs) go (DocCodeBlock block) = unlines (map (" " ++) (lines (go block))) ++ "\n"+#if MIN_VERSION_haddock(2,13,1)+ go (DocHyperlink (Hyperlink url label)) = maybe url (\l -> l ++ "[" ++ url ++ "]") label+#else go (DocURL url) = url+#endif go (DocPic pic) = pic go (DocAName name) = name go (DocExamples exs) = unlines (map formatExample exs)@@ -223,7 +232,11 @@ -- | Run an action with an initialized GHC package set. withInitializedPackages :: (DynFlags -> IO a) -> IO a withInitializedPackages cont = do+#if __GLASGOW_HASKELL__ < 706 dflags <- defaultErrorHandler defaultLogAction $ runGhc (Just libdir) $ do+#else+ dflags <- defaultErrorHandler defaultFatalMessager defaultFlushOut $ runGhc (Just libdir) $ do+#endif dflags <- getSessionDynFlags setSessionDynFlags dflags return dflags