From bc5756d062bbc5cad5d4fa60798435ed020c518e Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 11 Feb 2014 11:52:48 +0100 Subject: Improve display of poly-kinded type operators This now displays them as (==) k a b c ... to mirror GHC's behavior, instead of the old (k == a) b c ... which was just wrong. Signed-off-by: Mateusz Kowalczyk --- src/Haddock/Backends/LaTeX.hs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/Haddock/Backends/LaTeX.hs') diff --git a/src/Haddock/Backends/LaTeX.hs b/src/Haddock/Backends/LaTeX.hs index 2185340b..24e8b7c8 100644 --- a/src/Haddock/Backends/LaTeX.hs +++ b/src/Haddock/Backends/LaTeX.hs @@ -560,10 +560,10 @@ ppInstDecl unicode instHead = keyword "instance" <+> ppInstHead unicode instHead ppInstHead :: Bool -> InstHead DocName -> LaTeX -ppInstHead unicode (n, ts, ClassInst ctx) = ppContextNoLocs ctx unicode <+> ppAppNameTypes n ts unicode -ppInstHead unicode (n, ts, TypeInst rhs) = keyword "type" - <+> ppAppNameTypes n ts unicode <+> equals <+> ppType unicode rhs -ppInstHead _unicode (_n, _ts, DataInst _dd) = +ppInstHead unicode (n, ks, ts, ClassInst ctx) = ppContextNoLocs ctx unicode <+> ppAppNameTypes n ks ts unicode +ppInstHead unicode (n, ks, ts, TypeInst rhs) = keyword "type" + <+> ppAppNameTypes n ks ts unicode <+> equals <+> ppType unicode rhs +ppInstHead _unicode (_n, _ks, _ts, DataInst _dd) = error "data instances not supported by --latex yet" lookupAnySubdoc :: (Eq name1) => @@ -749,27 +749,27 @@ ppDataHeader _ _ = error "ppDataHeader: illegal argument" -------------------------------------------------------------------------------- --- | Print an application of a DocName and a list of HsTypes -ppAppNameTypes :: DocName -> [HsType DocName] -> Bool -> LaTeX -ppAppNameTypes n ts unicode = ppTypeApp n ts ppDocName (ppParendType unicode) +-- | Print an application of a DocName and two lists of HsTypes (kinds, types) +ppAppNameTypes :: DocName -> [HsType DocName] -> [HsType DocName] -> Bool -> LaTeX +ppAppNameTypes n ks ts unicode = ppTypeApp n ks ts ppDocName (ppParendType unicode) -- | Print an application of a DocName and a list of Names ppAppDocNameNames :: Bool -> DocName -> [Name] -> LaTeX ppAppDocNameNames _summ n ns = - ppTypeApp n ns (ppBinder . nameOccName . getName) ppSymName + ppTypeApp n [] ns (ppBinder . nameOccName . getName) ppSymName -- | General printing of type applications -ppTypeApp :: DocName -> [a] -> (DocName -> LaTeX) -> (a -> LaTeX) -> LaTeX -ppTypeApp n (t1:t2:rest) ppDN ppT +ppTypeApp :: DocName -> [a] -> [a] -> (DocName -> LaTeX) -> (a -> LaTeX) -> LaTeX +ppTypeApp n [] (t1:t2:rest) ppDN ppT | operator, not . null $ rest = parens opApp <+> hsep (map ppT rest) | operator = opApp where operator = isNameSym . getName $ n opApp = ppT t1 <+> ppDN n <+> ppT t2 -ppTypeApp n ts ppDN ppT = ppDN n <+> hsep (map ppT ts) +ppTypeApp n ks ts ppDN ppT = ppDN n <+> hsep (map ppT $ ks ++ ts) ------------------------------------------------------------------------------- -- cgit v1.2.3