From 44226fc06adfe66a1d9e63b142374710e482a4e1 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Mon, 4 Feb 2019 15:17:56 -0500 Subject: Fix #1015 with dataConUserTyVars (#1022) The central trick in this patch is to use `dataConUserTyVars` instead of `univ_tvs ++ ex_tvs`, which displays the foralls in a GADT constructor in a way that's more faithful to how the user originally wrote it. Fixes #1015. --- haddock-api/src/Haddock/Convert.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'haddock-api/src/Haddock') diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs index 3d2e37b9..d22efc9a 100644 --- a/haddock-api/src/Haddock/Convert.hs +++ b/haddock-api/src/Haddock/Convert.hs @@ -353,7 +353,8 @@ synifyDataCon use_gadt_syntax dc = use_named_field_syntax = not (null field_tys) name = synifyName dc -- con_qvars means a different thing depending on gadt-syntax - (univ_tvs, ex_tvs, _eq_spec, theta, arg_tys, res_ty) = dataConFullSig dc + (_univ_tvs, ex_tvs, _eq_spec, theta, arg_tys, res_ty) = dataConFullSig dc + user_tvs = dataConUserTyVars dc -- Used for GADT data constructors -- skip any EqTheta, use 'orig'inal syntax ctx | null theta = Nothing @@ -385,8 +386,8 @@ synifyDataCon use_gadt_syntax dc = then return $ noLoc $ ConDeclGADT { con_g_ext = noExt , con_names = [name] - , con_forall = noLoc False - , con_qvars = synifyTyVars (univ_tvs ++ ex_tvs) + , con_forall = noLoc $ not $ null user_tvs + , con_qvars = synifyTyVars user_tvs , con_mb_cxt = ctx , con_args = hat , con_res_ty = synifyType WithinType [] res_ty -- cgit v1.2.3