From 9aa5a2a420788e39806c5fe85845002181f3b945 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 8 Mar 2014 23:58:38 +0100 Subject: 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. --- src/Haddock/Options.hs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/Haddock') diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs index 12c80b6e..2e10827e 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 -- cgit v1.2.3