[commit: haddock] wip/T11080-open-data-kinds: Fix build errors (75eb16f)

git at git.haskell.org git at git.haskell.org
Tue Nov 28 11:43:28 UTC 2017


Repository : ssh://git@git.haskell.org/haddock

On branch  : wip/T11080-open-data-kinds
Link       : http://git.haskell.org/haddock.git/commitdiff/75eb16f18dda954d1d73989e04fc9b9e7edf1c6d

>---------------------------------------------------------------

commit 75eb16f18dda954d1d73989e04fc9b9e7edf1c6d
Author: Jan Stolarek <jan.stolarek at p.lodz.pl>
Date:   Thu Jan 14 17:23:03 2016 +0100

    Fix build errors


>---------------------------------------------------------------

75eb16f18dda954d1d73989e04fc9b9e7edf1c6d
 haddock-api/src/Haddock/Convert.hs | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs
index 38271a0..e1b942a 100644
--- a/haddock-api/src/Haddock/Convert.hs
+++ b/haddock-api/src/Haddock/Convert.hs
@@ -147,6 +147,7 @@ synifyTyCon _coax tc
 
            , tcdDataDefn = HsDataDefn { dd_ND = DataType  -- arbitrary lie, they are neither
                                                     -- algebraic data nor newtype:
+                                      , dd_kindOnly = AllowedInTerms
                                       , dd_ctxt = noLoc []
                                       , dd_cType = Nothing
                                       , dd_kindSig = Just (synifyKindSig (tyConKind tc))
@@ -197,6 +198,10 @@ synifyTyCon coax tc
   let
   alg_nd = if isNewTyCon tc then NewType else DataType
   alg_ctx = synifyCtx (tyConStupidTheta tc)
+  allowedInTerms | PromotedDataCon { dataCon = dc } <- tc
+                 , MkData { dcAllowedInTerms = AllowedInTypesOnly } <- dc
+                 = AllowedInTypesOnly
+                 | otherwise = AllowedInTerms
   name = case coax of
     Just a -> synifyName a -- Data families are named according to their
                            -- CoAxioms, not their TyCons
@@ -224,12 +229,13 @@ synifyTyCon coax tc
   cons = rights consRaw
   -- "deriving" doesn't affect the signature, no need to specify any.
   alg_deriv = Nothing
-  defn = HsDataDefn { dd_ND      = alg_nd
-                    , dd_ctxt    = alg_ctx
-                    , dd_cType   = Nothing
-                    , dd_kindSig = fmap synifyKindSig kindSig
-                    , dd_cons    = cons
-                    , dd_derivs  = alg_deriv }
+  defn = HsDataDefn { dd_ND       = alg_nd
+                    , dd_kindOnly = allowedInTerms
+                    , dd_ctxt     = alg_ctx
+                    , dd_cType    = Nothing
+                    , dd_kindSig  = fmap synifyKindSig kindSig
+                    , dd_cons     = cons
+                    , dd_derivs   = alg_deriv }
  in case lefts consRaw of
   [] -> return $
         DataDecl { tcdLName = name, tcdTyVars = tyvars, tcdDataDefn = defn



More information about the ghc-commits mailing list