[commit: haddock] adamse-D1033: StrictData: print correct strictness marks (53c47c6)
git at git.haskell.org
git at git.haskell.org
Wed Jul 8 08:43:12 UTC 2015
Repository : ssh://git@git.haskell.org/haddock
On branch : adamse-D1033
Link : http://git.haskell.org/haddock.git/commitdiff/53c47c6fc6cdaa5084b36ea6ba8320a460fa7106
>---------------------------------------------------------------
commit 53c47c6fc6cdaa5084b36ea6ba8320a460fa7106
Author: Adam Sandberg Eriksson <adam at sandbergericsson.se>
Date: Fri Jul 3 15:57:06 2015 +0200
StrictData: print correct strictness marks
>---------------------------------------------------------------
53c47c6fc6cdaa5084b36ea6ba8320a460fa7106
haddock-api/src/Haddock/Backends/LaTeX.hs | 7 +++++--
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 8 +++++---
haddock-api/src/Haddock/Convert.hs | 8 ++++----
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs
index e1090a0..86a6909 100644
--- a/haddock-api/src/Haddock/Backends/LaTeX.hs
+++ b/haddock-api/src/Haddock/Backends/LaTeX.hs
@@ -823,8 +823,11 @@ pp_hs_context cxt unicode = parenList (map (ppType unicode) cxt)
ppBang :: HsBang -> LaTeX
-ppBang HsNoBang = empty
-ppBang _ = char '!' -- Unpacked args is an implementation detail,
+ppBang HsStrict = char '!'
+ppBang (HsUnpack {}) = char '!'
+ppBang (HsSrcBang _ _ (Just True)) = char '!'
+ppBang (HsSrcBang _ _ (Just False)) = char '~'
+ppBang _ = empty
tupleParens :: HsTupleSort -> [LaTeX] -> LaTeX
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
index c0be973..2da4cc1 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
@@ -769,9 +769,11 @@ ppDataHeader _ _ _ _ = error "ppDataHeader: illegal argument"
ppBang :: HsBang -> Html
-ppBang HsNoBang = noHtml
-ppBang _ = toHtml "!" -- Unpacked args is an implementation detail,
- -- so we just show the strictness annotation
+ppBang HsStrict = toHtml "!"
+ppBang (HsUnpack {}) = toHtml "!"
+ppBang (HsSrcBang _ _ (Just True)) = toHtml "!"
+ppBang (HsSrcBang _ _ (Just False)) = toHtml "~"
+ppBang _ = noHtml
tupleParens :: HsTupleSort -> [Html] -> Html
diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs
index d841aec..c11ca54 100644
--- a/haddock-api/src/Haddock/Convert.hs
+++ b/haddock-api/src/Haddock/Convert.hs
@@ -269,13 +269,13 @@ synifyDataCon use_gadt_syntax dc =
linear_tys = zipWith (\ty bang ->
let tySyn = synifyType WithinType ty
src_bang = case bang of
- HsUnpack {} -> HsSrcBang Nothing (Just True) True
- HsStrict -> HsSrcBang Nothing (Just False) True
+ HsUnpack {} -> HsSrcBang Nothing (Just True) (Just True)
+ HsStrict -> HsSrcBang Nothing (Just False) (Just True)
+ HsLazy -> HsSrcBang Nothing Nothing Nothing
_ -> bang
in case src_bang of
- HsNoBang -> tySyn
+ (HsSrcBang _ Nothing Nothing) -> tySyn
_ -> noLoc $ HsBangTy bang tySyn
- -- HsNoBang never appears, it's implied instead.
)
arg_tys (dataConSrcBangs dc)
field_tys = zipWith (\field synTy -> noLoc $ ConDeclField
More information about the ghc-commits
mailing list