[commit: ghc] master: Fix Trac #8028. (67aacde)

Richard Eisenberg eir at cis.upenn.edu
Tue Jul 2 22:27:17 CEST 2013


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

On branch  : master

https://github.com/ghc/ghc/commit/67aacde3c9ec04b6e8e8e1d921001b218eb5244f

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

commit 67aacde3c9ec04b6e8e8e1d921001b218eb5244f
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Tue Jul 2 21:07:07 2013 +0100

    Fix Trac #8028.
    
    Check for an empty list of equations when converting
    a closed type family from TH to an HsDecl.

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

 compiler/hsSyn/Convert.lhs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs
index a07fafe..f7d5bdb 100644
--- a/compiler/hsSyn/Convert.lhs
+++ b/compiler/hsSyn/Convert.lhs
@@ -251,10 +251,13 @@ cvtDec (TySynInstD tc eqn)
                                         , tfid_fvs = placeHolderNames } } }
 
 cvtDec (ClosedTypeFamilyD tc tyvars mkind eqns)
+  | not $ null eqns
   = do { (_, tc', tvs') <- cvt_tycl_hdr [] tc tyvars
        ; mkind' <- cvtMaybeKind mkind
        ; eqns' <- mapM (cvtTySynEqn tc') eqns
        ; returnL $ TyClD (FamDecl (FamilyDecl (ClosedTypeFamily eqns') tc' tvs' mkind')) }
+  | otherwise
+  = failWith (ptext (sLit "Illegal empty closed type family"))
 ----------------
 cvtTySynEqn :: Located RdrName -> TySynEqn -> CvtM (LTyFamInstEqn RdrName)
 cvtTySynEqn tc (TySynEqn lhs rhs)





More information about the ghc-commits mailing list