diff options
Diffstat (limited to 'compiler/deSugar/DsUtils.hs')
-rw-r--r-- | compiler/deSugar/DsUtils.hs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/compiler/deSugar/DsUtils.hs b/compiler/deSugar/DsUtils.hs index db757d6afe..4ef279faed 100644 --- a/compiler/deSugar/DsUtils.hs +++ b/compiler/deSugar/DsUtils.hs @@ -92,7 +92,7 @@ hand, which should indeed be bound to the pattern as a whole, then use it; otherwise, make one up. -} -selectSimpleMatchVarL :: LPat Id -> DsM Id +selectSimpleMatchVarL :: LPat GhcTc -> DsM Id selectSimpleMatchVarL pat = selectMatchVar (unLoc pat) -- (selectMatchVars ps tys) chooses variables of type tys @@ -111,10 +111,10 @@ selectSimpleMatchVarL pat = selectMatchVar (unLoc pat) -- Then we must not choose (x::Int) as the matching variable! -- And nowadays we won't, because the (x::Int) will be wrapped in a CoPat -selectMatchVars :: [Pat Id] -> DsM [Id] +selectMatchVars :: [Pat GhcTc] -> DsM [Id] selectMatchVars ps = mapM selectMatchVar ps -selectMatchVar :: Pat Id -> DsM Id +selectMatchVar :: Pat GhcTc -> DsM Id selectMatchVar (BangPat pat) = selectMatchVar (unLoc pat) selectMatchVar (LazyPat pat) = selectMatchVar (unLoc pat) selectMatchVar (ParPat pat) = selectMatchVar (unLoc pat) @@ -174,7 +174,7 @@ The ``equation info'' used by @match@ is relatively complicated and worthy of a type synonym and a few handy functions. -} -firstPat :: EquationInfo -> Pat Id +firstPat :: EquationInfo -> Pat GhcTc firstPat eqn = ASSERT( notNull (eqn_pats eqn) ) head (eqn_pats eqn) shiftEqns :: [EquationInfo] -> [EquationInfo] @@ -255,7 +255,7 @@ mkGuardedMatchResult pred_expr (MatchResult _ body_fn) = MatchResult CanFail (\fail -> do body <- body_fn fail return (mkIfThenElse pred_expr body fail)) -mkCoPrimCaseMatchResult :: Id -- Scrutinee +mkCoPrimCaseMatchResult :: Id -- Scrutinee -> Type -- Type of the case -> [(Literal, MatchResult)] -- Alternatives -> MatchResult -- Literals are all unlifted @@ -414,7 +414,8 @@ mkDataConCase var ty alts@(alt1:_) = MatchResult fail_flag mk_case -- parallel arrays, which are introduced by `tidy1' in the `PArrPat' -- case -- -mkPArrCase :: DynFlags -> Id -> Type -> [CaseAlt DataCon] -> CoreExpr -> DsM CoreExpr +mkPArrCase :: DynFlags -> Id -> Type -> [CaseAlt DataCon] -> CoreExpr + -> DsM CoreExpr mkPArrCase dflags var ty sorted_alts fail = do lengthP <- dsDPHBuiltin lengthPVar alt <- unboxAlt @@ -725,7 +726,7 @@ work out well: -} mkSelectorBinds :: [[Tickish Id]] -- ^ ticks to add, possibly - -> LPat Id -- ^ The pattern + -> LPat GhcTc -- ^ The pattern -> CoreExpr -- ^ Expression to which the pattern is bound -> DsM (Id,[(Id,CoreExpr)]) -- ^ Id the rhs is bound to, for desugaring strict @@ -814,31 +815,31 @@ is_triv_pat _ = False * * ********************************************************************* -} -mkLHsPatTup :: [LPat Id] -> LPat Id +mkLHsPatTup :: [LPat GhcTc] -> LPat GhcTc mkLHsPatTup [] = noLoc $ mkVanillaTuplePat [] Boxed mkLHsPatTup [lpat] = lpat mkLHsPatTup lpats = L (getLoc (head lpats)) $ mkVanillaTuplePat lpats Boxed -mkLHsVarPatTup :: [Id] -> LPat Id +mkLHsVarPatTup :: [Id] -> LPat GhcTc mkLHsVarPatTup bs = mkLHsPatTup (map nlVarPat bs) -mkVanillaTuplePat :: [OutPat Id] -> Boxity -> Pat Id +mkVanillaTuplePat :: [OutPat GhcTc] -> Boxity -> Pat GhcTc -- A vanilla tuple pattern simply gets its type from its sub-patterns mkVanillaTuplePat pats box = TuplePat pats box (map hsLPatType pats) -- The Big equivalents for the source tuple expressions -mkBigLHsVarTupId :: [Id] -> LHsExpr Id +mkBigLHsVarTupId :: [Id] -> LHsExpr GhcTc mkBigLHsVarTupId ids = mkBigLHsTupId (map nlHsVar ids) -mkBigLHsTupId :: [LHsExpr Id] -> LHsExpr Id +mkBigLHsTupId :: [LHsExpr GhcTc] -> LHsExpr GhcTc mkBigLHsTupId = mkChunkified mkLHsTupleExpr -- The Big equivalents for the source tuple patterns -mkBigLHsVarPatTupId :: [Id] -> LPat Id +mkBigLHsVarPatTupId :: [Id] -> LPat GhcTc mkBigLHsVarPatTupId bs = mkBigLHsPatTupId (map nlVarPat bs) -mkBigLHsPatTupId :: [LPat Id] -> LPat Id +mkBigLHsPatTupId :: [LPat GhcTc] -> LPat GhcTc mkBigLHsPatTupId = mkChunkified mkLHsPatTup {- |