Skip to content
Snippets Groups Projects
Commit 44226fc0 authored by Ryan Scott's avatar Ryan Scott Committed by Alec Theriault
Browse files

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.
parent aa9644fc
No related branches found
No related tags found
No related merge requests found
...@@ -353,7 +353,8 @@ synifyDataCon use_gadt_syntax dc = ...@@ -353,7 +353,8 @@ synifyDataCon use_gadt_syntax dc =
use_named_field_syntax = not (null field_tys) use_named_field_syntax = not (null field_tys)
name = synifyName dc name = synifyName dc
-- con_qvars means a different thing depending on gadt-syntax -- 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 -- skip any EqTheta, use 'orig'inal syntax
ctx | null theta = Nothing ctx | null theta = Nothing
...@@ -385,8 +386,8 @@ synifyDataCon use_gadt_syntax dc = ...@@ -385,8 +386,8 @@ synifyDataCon use_gadt_syntax dc =
then return $ noLoc $ then return $ noLoc $
ConDeclGADT { con_g_ext = noExt ConDeclGADT { con_g_ext = noExt
, con_names = [name] , con_names = [name]
, con_forall = noLoc False , con_forall = noLoc $ not $ null user_tvs
, con_qvars = synifyTyVars (univ_tvs ++ ex_tvs) , con_qvars = synifyTyVars user_tvs
, con_mb_cxt = ctx , con_mb_cxt = ctx
, con_args = hat , con_args = hat
, con_res_ty = synifyType WithinType [] res_ty , con_res_ty = synifyType WithinType [] res_ty
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment