aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Sandberg Eriksson <adam@sandbergericsson.se>2015-07-14 21:01:01 +0200
committerAdam Sandberg Eriksson <adam@sandbergericsson.se>2015-08-09 23:01:05 +0200
commit62f3a12863121fa5b6c2787185e62cfa3f44bdd6 (patch)
tree56cfb6502b0b6ce76af8427249f35ce1ebf0f294
parent3436273f6e87d9358f6c23ad5b6b2838ce573892 (diff)
HsBang is split into HsSrcBang and HsImplBang
With recent changes in GHC handling of strictness annotations in Haddock is simplified.
-rw-r--r--haddock-api/src/Haddock/Backends/LaTeX.hs4
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml/Decl.hs4
-rw-r--r--haddock-api/src/Haddock/Convert.hs20
3 files changed, 10 insertions, 18 deletions
diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs
index d85d75da..b8558f4f 100644
--- a/haddock-api/src/Haddock/Backends/LaTeX.hs
+++ b/haddock-api/src/Haddock/Backends/LaTeX.hs
@@ -822,9 +822,7 @@ pp_hs_context cxt unicode = parenList (map (ppType unicode) cxt)
-------------------------------------------------------------------------------
-ppBang :: HsBang -> LaTeX
-ppBang HsStrict = char '!'
-ppBang (HsUnpack {}) = char '!'
+ppBang :: HsSrcBang -> LaTeX
ppBang (HsSrcBang _ _ SrcStrict) = char '!'
ppBang (HsSrcBang _ _ SrcLazy) = char '~'
ppBang _ = empty
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
index 21ef167b..b2b6f904 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
@@ -768,9 +768,7 @@ ppDataHeader _ _ _ _ = error "ppDataHeader: illegal argument"
--------------------------------------------------------------------------------
-ppBang :: HsBang -> Html
-ppBang HsStrict = toHtml "!"
-ppBang (HsUnpack {}) = toHtml "!"
+ppBang :: HsSrcBang -> Html
ppBang (HsSrcBang _ _ SrcStrict) = toHtml "!"
ppBang (HsSrcBang _ _ SrcLazy) = toHtml "~"
ppBang _ = noHtml
diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs
index edf91ce5..7c9040a9 100644
--- a/haddock-api/src/Haddock/Convert.hs
+++ b/haddock-api/src/Haddock/Convert.hs
@@ -266,18 +266,14 @@ synifyDataCon use_gadt_syntax dc =
-- skip any EqTheta, use 'orig'inal syntax
ctx = synifyCtx theta
- linear_tys = zipWith (\ty bang ->
- let tySyn = synifyType WithinType ty
- src_bang = case bang of
- HsUnpack {} -> HsSrcBang Nothing SrcUnpack SrcStrict
- HsStrict -> HsSrcBang Nothing SrcNoUnpack SrcStrict
- HsLazy -> HsSrcBang Nothing NoSrcUnpack NoSrcStrictness
- _ -> bang
- in case src_bang of
- (HsSrcBang _ NoSrcUnpack NoSrcStrictness) -> tySyn
- _ -> noLoc $ HsBangTy bang tySyn
- )
- arg_tys (dataConSrcBangs dc)
+ linear_tys =
+ zipWith (\ty bang ->
+ let tySyn = synifyType WithinType ty
+ in case bang of
+ (HsSrcBang _ NoSrcUnpack NoSrcStrict) -> tySyn
+ bang' -> noLoc $ HsBangTy bang' tySyn)
+ arg_tys (dataConSrcBangs dc)
+
field_tys = zipWith (\field synTy -> noLoc $ ConDeclField
[synifyName field] synTy Nothing)
(dataConFieldLabels dc) linear_tys