X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FhsSyn%2FHsExpr.lhs;fp=ghc%2Fcompiler%2FhsSyn%2FHsExpr.lhs;h=dbdd24c3c5b75e2e5cf19bddded19d5fc061d17f;hb=ac10f8408520a30e8437496d320b8b86afda2e8f;hp=86c41906bf3cc339d4d3243245a1f578ade9eeab;hpb=479cc24837aa2c14c3bbed323bb640a5c53a2522;p=ghc-hetmet.git diff --git a/ghc/compiler/hsSyn/HsExpr.lhs b/ghc/compiler/hsSyn/HsExpr.lhs index 86c4190..dbdd24c 100644 --- a/ghc/compiler/hsSyn/HsExpr.lhs +++ b/ghc/compiler/hsSyn/HsExpr.lhs @@ -14,13 +14,13 @@ import HsPat ( LPat ) import HsLit ( HsLit(..), HsOverLit ) import HsTypes ( LHsType, PostTcType ) import HsImpExp ( isOperator, pprHsVar ) -import HsBinds ( HsLocalBinds, DictBinds, isEmptyLocalBinds ) +import HsBinds ( HsLocalBinds, DictBinds, ExprCoFn, isEmptyLocalBinds ) -- others: import Type ( Type, pprParendType ) import Var ( TyVar, Id ) import Name ( Name ) -import BasicTypes ( IPName, Boxity, tupleParens, Fixity(..) ) +import BasicTypes ( IPName, Boxity, tupleParens, Arity, Fixity(..) ) import SrcLoc ( Located(..), unLoc ) import Outputable import FastString @@ -254,6 +254,9 @@ Everything from here on appears only in typechecker output. (LHsExpr id) [id] + | HsCoerce ExprCoFn -- TRANSLATION + (HsExpr id) + type PendingSplice = (Name, LHsExpr Id) -- Typechecked splices, waiting to be -- pasted back in by the desugarer \end{code} @@ -415,6 +418,8 @@ ppr_expr (DictApp expr dnames) = hang (ppr_lexpr expr) 4 (brackets (interpp'SP dnames)) +ppr_expr (HsCoerce co_fn e) = ppr_expr e + ppr_expr (HsType id) = ppr id ppr_expr (HsSpliceE s) = pprSplice s @@ -613,6 +618,14 @@ data Match id -- Nothing after typechecking (GRHSs id) +matchGroupArity :: MatchGroup id -> Arity +matchGroupArity (MatchGroup (match:matches) _) + = ASSERT( all ((== n_pats) . length . hsLMatchPats) matches ) + -- Assertion just checks that all the matches have the same number of pats + n_pats + where + n_pats = length (hsLMatchPats match) + hsLMatchPats :: LMatch id -> [LPat id] hsLMatchPats (L _ (Match pats _ _)) = pats