X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FdeSugar%2FMatch.lhs;h=1f9fcdadf26c6477e97a8d4f5c8546293b41a688;hb=af93bb787305c0401eb658f149021e22d1ab98cc;hp=74be345ca1853189e91399b8f875c34ca6e794fc;hpb=5e3f005d3012472e422d4ffd7dca5c21a80fca80;p=ghc-hetmet.git diff --git a/ghc/compiler/deSugar/Match.lhs b/ghc/compiler/deSugar/Match.lhs index 74be345..1f9fcda 100644 --- a/ghc/compiler/deSugar/Match.lhs +++ b/ghc/compiler/deSugar/Match.lhs @@ -24,7 +24,8 @@ import MatchCon ( matchConFamily ) import MatchLit ( matchLiterals ) import PrelInfo ( pAT_ERROR_ID ) import TcType ( mkTyVarTys, Type, tcTyConAppArgs, tcEqType ) -import TysWiredIn ( nilDataCon, consDataCon, mkTupleTy, mkListTy, tupleCon ) +import TysWiredIn ( nilDataCon, consDataCon, mkTupleTy, mkListTy, + tupleCon, parrFakeCon, mkPArrTy ) import BasicTypes ( Boxity(..) ) import UniqSet import ErrUtils ( addWarnLocHdrLine, dontAddErrLoc ) @@ -314,7 +315,8 @@ Replace the `as' pattern @x@@p@ with the pattern p and a binding @x = v@. \item Removing lazy (irrefutable) patterns (you don't want to know...). \item -Converting explicit tuple- and list-pats into ordinary @ConPats@. +Converting explicit tuple-, list-, and parallel-array-pats into ordinary +@ConPats@. \item Convert the literal pat "" to []. \end{itemize} @@ -441,6 +443,15 @@ tidy1 v (ListPat ty pats) match_result (ConPat nilDataCon list_ty [] [] []) pats +-- introduce fake parallel array constructors to be able to handle parallel +-- arrays with the existing machinery for constructor pattern +-- +tidy1 v (PArrPat ty pats) match_result + = returnDs (parrConPat, match_result) + where + arity = length pats + parrConPat = ConPat (parrFakeCon arity) (mkPArrTy ty) [] [] pats + tidy1 v (TuplePat pats boxity) match_result = returnDs (tuple_ConPat, match_result) where