[commit: haddock] wip/10692: Replace (SourceText, FastString) with WithSourceText data type (b5c8844)

git at git.haskell.org git at git.haskell.org
Mon Nov 20 20:49:03 UTC 2017


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

On branch  : wip/10692
Link       : http://git.haskell.org/haddock.git/commitdiff/b5c884407e58765dc4e4499559c7d3030fed6753

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

commit b5c884407e58765dc4e4499559c7d3030fed6753
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Sun Jul 26 22:19:40 2015 +0200

    Replace (SourceText,FastString) with WithSourceText data type
    
    Phab:D907 introduced SourceText for a number of data types, by replacing
    FastString with (SourceText,FastString). Since this has an Outputable
    instance, no warnings are generated when ppr is called on it, but
    unexpected output is generated. See Phab:D1096 for an example of this.
    
    Replace the (SourceText,FastString) tuples with a new data type
    
    data WithSourceText = WithSourceText SourceText FastString
    
    Trac ticket: #10692


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

b5c884407e58765dc4e4499559c7d3030fed6753
 haddock-api/src/Haddock/Interface/Create.hs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs
index 5adaef6..efcb4e8 100644
--- a/haddock-api/src/Haddock/Interface/Create.hs
+++ b/haddock-api/src/Haddock/Interface/Create.hs
@@ -45,6 +45,7 @@ import Bag
 import RdrName
 import TcRnTypes
 import FastString (concatFS)
+import BasicTypes ( WithSourceText(..) )
 import qualified Outputable as O
 
 -- | Use a 'TypecheckedModule' to produce an 'Interface'.
@@ -158,7 +159,7 @@ mkAliasMap dflags mRenamedSource =
         return $
           (lookupModuleDyn dflags
              (fmap Module.fsToPackageKey $
-              fmap snd $ ideclPkgQual impDecl)
+              fmap wst_fs $ ideclPkgQual impDecl)
              (case ideclName impDecl of SrcLoc.L _ name -> name),
            alias))
         impDecls
@@ -194,8 +195,8 @@ moduleWarning dflags gre (WarnAll w) = Just $ parseWarning dflags gre w
 
 parseWarning :: DynFlags -> GlobalRdrEnv -> WarningTxt -> Doc Name
 parseWarning dflags gre w = force $ case w of
-  DeprecatedTxt _ msg -> format "Deprecated: " (concatFS $ map (snd . unLoc) msg)
-  WarningTxt    _ msg -> format "Warning: "    (concatFS $ map (snd . unLoc) msg)
+  DeprecatedTxt _ msg -> format "Deprecated: " (concatFS $ map (wst_fs . unLoc) msg)
+  WarningTxt    _ msg -> format "Warning: "    (concatFS $ map (wst_fs . unLoc) msg)
   where
     format x xs = DocWarning . DocParagraph . DocAppend (DocString x)
                   . processDocString dflags gre $ HsDocString xs



More information about the ghc-commits mailing list