Commit 936001ca authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Improve validity check to give better error message

Fixes Trac #7809
parent 8d49ef16
......@@ -305,7 +305,7 @@ check_syn_tc_app ctxt rank ty tc tys
; liberal <- xoptM Opt_LiberalTypeSynonyms
; if not liberal || isSynFamilyTyCon tc then
-- For H98 and synonym families, do check the type args
mapM_ (check_mono_type ctxt synArgMonoType) tys
mapM_ check_arg tys
else -- In the liberal case (only for closed syns), expand then check
case tcView ty of
......@@ -314,13 +314,15 @@ check_syn_tc_app ctxt rank ty tc tys
| GhciCtxt <- ctxt -- Accept under-saturated type synonyms in
-- GHCi :kind commands; see Trac #7586
= mapM_ (check_mono_type ctxt synArgMonoType) tys
= mapM_ check_arg tys
| otherwise
= failWithTc (arityErr "Type synonym" (tyConName tc) tc_arity n_args)
where
n_args = length tys
tc_arity = tyConArity tc
check_arg | isSynFamilyTyCon tc = check_arg_type ctxt rank
| otherwise = check_mono_type ctxt synArgMonoType
----------------------------------------
check_ubx_tuple :: UserTypeCtxt -> KindOrType
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment