diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-10-24 07:07:15 -0400 |
---|---|---|
committer | Alexander Biehl <alexbiehl@gmail.com> | 2017-10-24 13:07:15 +0200 |
commit | d4375d8ec96991de2578fd65c79d0487f6a440d8 (patch) | |
tree | 99e72fdac3168ff484beefab3f56e9ed3dd2f341 /haddock-api/src/Haddock/Backends/LaTeX.hs | |
parent | 88e30124499df08eb1a37ec44e342c1e69cf5029 (diff) |
Overhaul Haddock's rendering of kind signatures (#681)
* Overhaul Haddock's rendering of kind signatures
* Strip off kind signatures when specializing
As an added bonus, this lets us remove an ugly hack specifically for `(->)`.
Yay!
* Update due to 0390e4a0f61e37bd1dcc24a36d499e92f2561b67
* @alexbiehl's suggestions
* Import injectiveVarsOfBinder from GHC
Diffstat (limited to 'haddock-api/src/Haddock/Backends/LaTeX.hs')
-rw-r--r-- | haddock-api/src/Haddock/Backends/LaTeX.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs index 1cc23e6e..d79e0e6c 100644 --- a/haddock-api/src/Haddock/Backends/LaTeX.hs +++ b/haddock-api/src/Haddock/Backends/LaTeX.hs @@ -553,7 +553,7 @@ ppInstHead unicode (InstHead {..}) = case ihdInstType of TypeInst rhs -> keyword "type" <+> typ <+> tibody rhs DataInst _ -> error "data instances not supported by --latex yet" where - typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode + typ = ppAppNameTypes ihdClsName ihdTypes unicode tibody = maybe empty (\t -> equals <+> ppType unicode t) lookupAnySubdoc :: (Eq name1) => @@ -831,27 +831,27 @@ ppDataHeader _ _ = error "ppDataHeader: illegal argument" -------------------------------------------------------------------------------- --- | Print an application of a DocName and two lists of HsTypes (kinds, types) -ppAppNameTypes :: DocName -> [HsType DocNameI] -> [HsType DocNameI] -> Bool -> LaTeX -ppAppNameTypes n ks ts unicode = ppTypeApp n ks ts ppDocName (ppParendType unicode) +-- | Print an application of a DocName to its list of HsTypes +ppAppNameTypes :: DocName -> [HsType DocNameI] -> Bool -> LaTeX +ppAppNameTypes n ts unicode = ppTypeApp n 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] -> [a] -> (DocName -> LaTeX) -> (a -> LaTeX) -> LaTeX -ppTypeApp n [] (t1:t2:rest) ppDN ppT +ppTypeApp :: DocName -> [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 ks ts ppDN ppT = ppDN n <+> hsep (map ppT $ ks ++ ts) +ppTypeApp n ts ppDN ppT = ppDN n <+> hsep (map ppT ts) ------------------------------------------------------------------------------- |