[commit: ghc] master: Improve validity check to give better error message (936001c)

Simon Peyton Jones simonpj at microsoft.com
Thu May 30 15:06:32 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/936001caa0dc045aa937c9f256b338429664d83c

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

commit 936001caa0dc045aa937c9f256b338429664d83c
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu May 30 12:33:56 2013 +0100

    Improve validity check to give better error message
    
    Fixes Trac #7809

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

 compiler/typecheck/TcValidity.lhs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/compiler/typecheck/TcValidity.lhs b/compiler/typecheck/TcValidity.lhs
index e232598..5437719 100644
--- a/compiler/typecheck/TcValidity.lhs
+++ b/compiler/typecheck/TcValidity.lhs
@@ -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 





More information about the ghc-commits mailing list