diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-01-19 15:59:19 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-02-27 10:14:03 -0500 |
commit | 8459c600e0f6da3f85abefdefe651bbe3ed3da4a (patch) | |
tree | a0f2b418b545bbbc98961f494faec13a9d539bfd /haddock-api/src/Haddock/Backends/HaddockDB.hs | |
parent | d667f4e0a4ffc581dbbdddf01b5e5c88bd60e790 (diff) |
Visible dependent quantification (#16326) changes
Diffstat (limited to 'haddock-api/src/Haddock/Backends/HaddockDB.hs')
-rw-r--r-- | haddock-api/src/Haddock/Backends/HaddockDB.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/haddock-api/src/Haddock/Backends/HaddockDB.hs b/haddock-api/src/Haddock/Backends/HaddockDB.hs index 0bdc9057..6c48804a 100644 --- a/haddock-api/src/Haddock/Backends/HaddockDB.hs +++ b/haddock-api/src/Haddock/Backends/HaddockDB.hs @@ -104,17 +104,22 @@ ppHsContext context = parenList (map (\ (a,b) -> ppHsQName a <+> hsep (map ppHsAType b)) context) ppHsType :: HsType -> Doc -ppHsType (HsForAllType Nothing context htype) = +ppHsType (HsForAllType _ Nothing context htype) = hsep [ ppHsContext context, text "=>", ppHsType htype] -ppHsType (HsForAllType (Just tvs) [] htype) = - hsep (text "forall" : map ppHsName tvs ++ text "." : [ppHsType htype]) -ppHsType (HsForAllType (Just tvs) context htype) = - hsep (text "forall" : map ppHsName tvs ++ text "." : +ppHsType (HsForAllType fvf (Just tvs) [] htype) = + hsep (text "forall" : map ppHsName tvs ++ pprHsForAllSeparator fvf : + [ppHsType htype]) +ppHsType (HsForAllType fvf (Just tvs) context htype) = + hsep (text "forall" : map ppHsName tvs ++ pprHsForAllSeparator fvf : ppHsContext context : text "=>" : [ppHsType htype]) ppHsType (HsTyFun a b) = fsep [ppHsBType a, text "->", ppHsType b] ppHsType (HsTyIP n t) = fsep [(char '?' <> ppHsName n), text "::", ppHsType t] ppHsType t = ppHsBType t +ppHsForAllSeparator :: ForallVisFlag -> Doc +ppHsForAllSeparator ForallVis = text "->" +ppHsForAllSeparator ForallInvis = text "." + ppHsBType (HsTyApp (HsTyCon (Qual (Module "Prelude") (HsTyClsName (HsSpecial "[]")))) b ) = brackets $ ppHsType b ppHsBType (HsTyApp a b) = fsep [ppHsBType a, ppHsAType b] |