[commit: haddock] master: Use optLast instead of listToMaybe for sourceUrls/wikiUrls (9aa5a2a)

git at git.haskell.org git at git.haskell.org
Sun Mar 9 07:12:20 UTC 2014


Repository : ssh://git@git.haskell.org/haddock

On branch  : master
Link       : http://git.haskell.org/haddock.git/commitdiff/9aa5a2a420788e39806c5fe85845002181f3b945

>---------------------------------------------------------------

commit 9aa5a2a420788e39806c5fe85845002181f3b945
Author: Niklas Haas <git at nand.wakku.to>
Date:   Sat Mar 8 23:58:38 2014 +0100

    Use optLast instead of listToMaybe for sourceUrls/wikiUrls
    
    This lets you override them using eg. cabal haddock --haddock-options,
    which can come in handy if you want to use a different layout or URL for
    your source code links than cabal-install generates.


>---------------------------------------------------------------

9aa5a2a420788e39806c5fe85845002181f3b945
 src/Haddock/Options.hs |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs
index 12c80b6..2e10827 100644
--- a/src/Haddock/Options.hs
+++ b/src/Haddock/Options.hs
@@ -32,7 +32,6 @@ module Haddock.Options (
 ) where
 
 
-import Data.Maybe
 import Distribution.Verbosity
 import Haddock.Utils
 import Haddock.Types
@@ -219,16 +218,16 @@ optCssFile flags = optLast [ str | Flag_CSS str <- flags ]
 
 sourceUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String)
 sourceUrls flags =
-  (listToMaybe [str | Flag_SourceBaseURL   str <- flags]
-  ,listToMaybe [str | Flag_SourceModuleURL str <- flags]
-  ,listToMaybe [str | Flag_SourceEntityURL str <- flags])
+  (optLast [str | Flag_SourceBaseURL   str <- flags]
+  ,optLast [str | Flag_SourceModuleURL str <- flags]
+  ,optLast [str | Flag_SourceEntityURL str <- flags])
 
 
 wikiUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String)
 wikiUrls flags =
-  (listToMaybe [str | Flag_WikiBaseURL   str <- flags]
-  ,listToMaybe [str | Flag_WikiModuleURL str <- flags]
-  ,listToMaybe [str | Flag_WikiEntityURL str <- flags])
+  (optLast [str | Flag_WikiBaseURL   str <- flags]
+  ,optLast [str | Flag_WikiModuleURL str <- flags]
+  ,optLast [str | Flag_WikiEntityURL str <- flags])
 
 
 optDumpInterfaceFile :: [Flag] -> Maybe FilePath



More information about the ghc-commits mailing list