diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-02-04 15:17:56 -0500 |
---|---|---|
committer | Alec Theriault <alec.theriault@gmail.com> | 2019-02-04 12:17:56 -0800 |
commit | 44226fc06adfe66a1d9e63b142374710e482a4e1 (patch) | |
tree | b943daa4fb8aa2e3a464c13e625e713aad9c1eea /haddock-api | |
parent | aa9644fc4179de044557438f2bd3003642750a97 (diff) |
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.
Diffstat (limited to 'haddock-api')
-rw-r--r-- | haddock-api/src/Haddock/Convert.hs | 7 |
1 files changed, 4 insertions, 3 deletions
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 |