2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
4 \section[CoreSyn]{A data type for the Haskell compiler midsection}
7 #include "HsVersions.h"
10 CoreBinding(..), CoreExpr(..), CoreAtom(..),
11 CoreCaseAlternatives(..), CoreCaseDefault(..),
14 CoreParCommunicate(..),
15 #endif {- Data Parallel Haskell -}
17 pprCoreBinding, pprCoreExpr,
19 CoreArg(..), applyToArgs, decomposeArgs, collectArgs,
21 -- and to make the interface self-sufficient ...
22 Id, UniType, TyVar, TyCon, PrimOp, BasicLit,
23 PprStyle, PrettyRep, CostCentre, Maybe
26 import AbsPrel ( PrimOp, PrimKind
27 IF_ATTACK_PRAGMAS(COMMA tagOf_PrimOp)
28 IF_ATTACK_PRAGMAS(COMMA pprPrimOp)
30 import AbsUniType ( isPrimType, pprParendUniType, TyVar, TyCon, UniType
31 IF_ATTACK_PRAGMAS(COMMA cmpTyCon COMMA cmpTyVar)
32 IF_ATTACK_PRAGMAS(COMMA cmpUniType)
34 import BasicLit ( BasicLit )
35 import Id ( getIdUniType, isBottomingId, Id
36 IF_ATTACK_PRAGMAS(COMMA bottomIsGuaranteed)
40 import CostCentre ( showCostCentre, CostCentre )
44 %************************************************************************
46 \subsection[CoreTopBinding_and_CoreBinding]{@CoreTopBinding@ and @CoreBinding@}
48 %************************************************************************
50 Core programs, bindings, expressions, etc., are parameterised with
51 respect to the information kept about binding and bound occurrences of
52 variables, called {\em binders} and {\em bindees}, respectively. [I
53 don't really like the pair of names; I prefer {\em binder} and {\em
54 bounder}. Or {\em binder} and {\em var}.]
56 A @CoreBinding@ is either a single non-recursive binding of a
57 ``binder'' to an expression, or a mutually-recursive blob of same.
59 data CoreBinding binder bindee
60 = CoNonRec binder (CoreExpr binder bindee)
61 | CoRec [(binder, CoreExpr binder bindee)]
64 %************************************************************************
66 \subsection[CoreAtom]{Core atoms: @CoreAtom@}
68 %************************************************************************
70 Same deal as @StgAtoms@, except that, for @Core@, the atomic object
71 may need to be applied to some types.
79 %************************************************************************
81 \subsection[CoreExpr]{Core expressions: @CoreExpr@}
83 %************************************************************************
85 @CoreExpr@ is the heart of the ``core'' data types; it is
86 (more-or-less) boiled-down second-order polymorphic lambda calculus.
87 For types in the core world, we just keep using @UniTypes@.
89 data CoreExpr binder bindee
91 | CoLit BasicLit -- literal constants
94 @CoCons@ and @CoPrims@ are saturated constructor and primitive-op
95 applications (see the comment). Note: @CoCon@s are only set up by the
96 simplifier (and by the desugarer when it knows what it's doing). The
97 desugarer sets up constructors as applications of global @CoVars@s.
99 | CoCon Id [UniType] [CoreAtom bindee]
100 -- saturated constructor application:
101 -- the constructor is a function of the form:
102 -- /\ a1 -> ... /\ am -> \ b1 -> ... \ bn ->
103 -- <expr> where "/\" is a type lambda and "\" the
104 -- regular kind; there will be "m" UniTypes and
105 -- "n" bindees in the CoCon args.
107 | CoPrim PrimOp [UniType] [CoreAtom bindee]
108 -- saturated primitive operation;
109 -- comment on CoCons applies here, too.
110 -- The types work the same way
111 -- (PrimitiveOps may be polymorphic).
114 Lambdas have multiple binders; this is good for the lambda lifter.
115 Single binders may be simulated easily with multiple binders; vice
118 | CoLam [binder] -- lambda var_1 ... var_n -> CoreExpr
119 (CoreExpr binder bindee)
120 | CoTyLam TyVar -- Lambda TyVar -> CoreExpr
121 (CoreExpr binder bindee)
123 | CoApp (CoreExpr binder bindee)
125 | CoTyApp (CoreExpr binder bindee)
126 UniType -- type application
129 Case expressions (\tr{case CoreExpr of <List of alternatives>}): there
130 are really two flavours masquerading here---those for scrutinising
131 {\em algebraic} types and those for {\em primitive} types. Please see
132 under @CoreCaseAlternatives@.
134 | CoCase (CoreExpr binder bindee)
135 (CoreCaseAlternatives binder bindee)
138 A Core case expression \tr{case e of v -> ...} implies evaluation of
139 \tr{e}; it is not equivalent to \tr{let v = in ...} (as with a Haskell
142 Non-recursive @CoLets@ only have one binding; having more than one
143 doesn't buy you much, and it is an easy way to mess up variable
146 | CoLet (CoreBinding binder bindee)
147 (CoreExpr binder bindee)
148 -- both recursive and non-.
149 -- The "CoreBinding" records that information
152 @build@ as a function is a *PAIN*. See Andy's thesis for
153 futher details. This is equivalent to:
155 build unitype (/\ tyvar \ c n -> expr)
159 -- | CoBuild UniType TyVar binder binder (CoreExpr binder bindee)
162 @CoZfExpr@ exist in the core language, along with their qualifiers. After
163 succesive optimisations to the sequential bindings, we desugar the
164 @CoZfExpr@ into a subset of the core language without them - ``podization''.
167 | CoZfExpr (CoreExpr binder bindee)
168 (CoreParQuals binder bindee)
169 #endif {- Data Parallel Haskell -}
172 @CoParCon@ is the parallel equivalent to the sequential @CoCon@ expression.
173 They are introduced into the core syntax by a pass of the compiler that
174 removes the parallel ZF expressions, and {\em vectorises} ordinary sequential
178 | CoParCon Id Int [UniType] [CoreExpr binder bindee] --ToDo:DPH: CoreAtom
179 #endif {- Data Parallel Haskell -}
182 @CoParCommunicate@ constructs are introduced by the desugaring of parallel
188 (CoreExpr binder bindee)
189 (CoreParCommunicate binder bindee)
190 #endif {- Data Parallel Haskell -}
193 @CoParZipWith@ constructs are introduced whenever podization fails during the
194 desuagring of ZF expressions. These constructs represent zipping the function
195 represented by the first @CoreExpr@ with the list of @CoreExpr@'s (hopefully
196 we wont see this that often in the resultant program :-).
202 (CoreExpr binder bindee)
203 [CoreExpr binder bindee]
204 #endif {- Data Parallel Haskell -}
207 For cost centre scc expressions we introduce a new core construct
208 @CoSCC@ so transforming passes have to deal with it explicitly. The
209 alternative of using a new PrimativeOp may result in a bad
210 transformations of which we are unaware.
212 | CoSCC CostCentre -- label of scc
213 (CoreExpr binder bindee) -- scc expression
219 %************************************************************************
221 \subsection[CoreParQualifiers]{Parallel qualifiers in @CoreExpr@}
223 %************************************************************************
227 data CoreParQuals binder bindee
228 = CoAndQuals (CoreParQuals binder bindee)
229 (CoreParQuals binder bindee)
230 | CoParFilter (CoreExpr binder bindee)
231 | CoDrawnGen [binder]
233 (CoreExpr binder bindee)
234 | CoIndexGen [CoreExpr binder bindee]
236 (CoreExpr binder bindee)
237 #endif {- Data Parallel Haskell -}
240 %************************************************************************
242 \subsection[ParCommunicate]{Parallel Communication primitives}
244 %************************************************************************
247 data CoreParCommunicate binder bindee
248 = CoParSend [CoreExpr binder bindee] -- fns of form Integer -> Integer
249 | CoParFetch [CoreExpr binder bindee] -- to determine where moved
252 #endif {- Data Parallel Haskell -}
255 %************************************************************************
257 \subsection[CoreCaseAlternatives]{Case alternatives in @CoreExpr@}
259 %************************************************************************
261 We have different kinds of @case@s, the differences being reflected in
262 the kinds of alternatives a case has. We maintain a distinction
263 between cases for scrutinising algebraic datatypes, as opposed to
264 primitive types. In both cases, we carry around a @TyCon@, as a
265 handle with which we can get info about the case (e.g., total number
266 of data constructors for this type).
274 CoCase e [ CoBindDefaultAlt x -> b ]
278 data CoreCaseAlternatives binder bindee
280 = CoAlgAlts [(Id, -- alts: data constructor,
281 [binder], -- constructor's parameters,
282 CoreExpr binder bindee)] -- rhs.
283 (CoreCaseDefault binder bindee)
285 | CoPrimAlts [(BasicLit, -- alts: unboxed literal,
286 CoreExpr binder bindee)] -- rhs.
287 (CoreCaseDefault binder bindee)
294 CoreExpr binder bindee)]
295 (CoreCaseDefault binder bindee)
301 CoreExpr binder bindee)]
302 (CoreCaseDefault binder bindee)
303 #endif {- Data Parallel Haskell -}
305 -- obvious things: if there are no alts in the list, then the default
306 -- can't be CoNoDefault.
308 data CoreCaseDefault binder bindee
309 = CoNoDefault -- small con family: all
310 -- constructor accounted for
311 | CoBindDefault binder -- form: var -> expr;
312 (CoreExpr binder bindee) -- "binder" may or may not
316 %************************************************************************
318 \subsection[CoreSyn-arguments]{Core ``argument'' wrapper type}
320 %************************************************************************
325 | ValArg (CoreAtom bindee)
327 instance Outputable bindee => Outputable (CoreArg bindee) where
328 ppr sty (ValArg atom) = ppr sty atom
329 ppr sty (TypeArg ty) = ppr sty ty
333 mkCoTyApp expr ty = CoTyApp expr ty
335 {- OLD: unboxed tyapps now allowed!
338 | isPrimType ty && not (error_app expr)
339 = pprPanic "mkCoTyApp:" (ppr PprDebug ty)
343 ty_app = CoTyApp expr ty
345 error_app (CoVar id) {-| isBottomingId id-} = True -- debugging
346 -- OOPS! can't do this because it forces
347 -- the bindee type to be Id (ToDo: what?) WDP 95/02
353 applyToArgs :: CoreExpr binder bindee
355 -> CoreExpr binder bindee
357 applyToArgs fun [] = fun
358 applyToArgs fun (ValArg val : args) = applyToArgs (CoApp fun val) args
359 applyToArgs fun (TypeArg ty : args) = applyToArgs (mkCoTyApp fun ty) args
362 @decomposeArgs@ just pulls of the contiguous TypeArg-then-ValArg block
363 on the front of the args. Pretty common.
366 decomposeArgs :: [CoreArg bindee]
367 -> ([UniType], [CoreAtom bindee], [CoreArg bindee])
369 decomposeArgs [] = ([],[],[])
371 decomposeArgs (TypeArg ty : args)
372 = case (decomposeArgs args) of { (tys, vals, rest) ->
373 (ty:tys, vals, rest) }
375 decomposeArgs (ValArg val : args)
376 = case (do_vals args) of { (vals, rest) ->
377 ([], val:vals, rest) }
379 do_vals (ValArg val : args)
380 = case (do_vals args) of { (vals, rest) ->
383 do_vals args = ([], args)
386 @collectArgs@ takes an application expression, returning the function
387 and the arguments to which it is applied.
390 collectArgs :: CoreExpr binder bindee
391 -> (CoreExpr binder bindee, [CoreArg bindee])
396 collect (CoApp fun arg) args = collect fun (ValArg arg : args)
397 collect (CoTyApp fun ty) args = collect fun (TypeArg ty : args)
398 collect other_expr args = (other_expr, args)
401 %************************************************************************
403 \subsection[CoreSyn-output]{Instance declarations for output}
405 %************************************************************************
407 @pprCoreBinding@ and @pprCoreExpr@ let you give special printing
408 function for ``major'' binders (those next to equal signs :-),
409 ``minor'' ones (lambda-bound, case-bound), and bindees. They would
410 usually be called through some intermediary.
415 -> (PprStyle -> bndr -> Pretty) -- to print "major" binders
416 -> (PprStyle -> bndr -> Pretty) -- to print "minor" binders
417 -> (PprStyle -> bdee -> Pretty) -- to print bindees
418 -> CoreBinding bndr bdee
421 pprCoreBinding sty pbdr1 pbdr2 pbdee (CoNonRec binder expr)
422 = ppHang (ppCat [pbdr1 sty binder, ppEquals])
423 4 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr)
425 pprCoreBinding sty pbdr1 pbdr2 pbdee (CoRec binds)
426 = ppAboves [ifPprDebug sty (ppStr "{- CoRec -}"),
427 ppAboves (map ppr_bind binds),
428 ifPprDebug sty (ppStr "{- end CoRec -}")]
430 ppr_bind (binder, expr)
431 = ppHang (ppCat [pbdr1 sty binder, ppEquals])
432 4 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr)
436 instance (Outputable bndr, Outputable bdee)
437 => Outputable (CoreBinding bndr bdee) where
438 ppr sty bind = pprCoreBinding sty ppr ppr ppr bind
440 instance (Outputable bndr, Outputable bdee)
441 => Outputable (CoreExpr bndr bdee) where
442 ppr sty expr = pprCoreExpr sty ppr ppr ppr expr
444 instance Outputable bdee => Outputable (CoreAtom bdee) where
445 ppr sty atom = pprCoreAtom sty ppr atom
451 -> (PprStyle -> bdee -> Pretty) -- to print bindees
455 pprCoreAtom sty pbdee (CoLitAtom lit) = ppr sty lit
456 pprCoreAtom sty pbdee (CoVarAtom v) = pbdee sty v
460 pprCoreExpr, pprParendCoreExpr
462 -> (PprStyle -> bndr -> Pretty) -- to print "major" binders
463 -> (PprStyle -> bndr -> Pretty) -- to print "minor" binders
464 -> (PprStyle -> bdee -> Pretty) -- to print bindees
465 -> CoreExpr bndr bdee
468 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoVar name) = pbdee sty name
470 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoLit literal) = ppr sty literal
472 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoCon con [] []) = ppr sty con
474 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoCon con types args)
475 = ppHang (ppBesides [ppr sty con, ppChar '!'])
476 4 (ppSep ( (map (pprParendUniType sty) types)
477 ++ (map (pprCoreAtom sty pbdee) args)))
479 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoPrim prim tys args)
480 = ppHang (ppBesides [ppr sty prim, ppChar '!'])
481 4 (ppSep ( (map (pprParendUniType sty) tys)
482 ++ (map (pprCoreAtom sty pbdee) args) ))
484 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoLam binders expr)
485 = ppHang (ppCat [ppStr "\\", ppInterleave ppSP (map (pbdr2 sty) binders), ppStr "->"])
486 4 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr)
488 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoTyLam tyvar expr)
489 = ppHang (ppCat [ppStr "/\\", interppSP sty (tyvar:tyvars),
490 ppStr "->", pp_varss var_lists])
491 4 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr_after)
493 (tyvars, var_lists, expr_after) = collect_tyvars expr
495 collect_tyvars (CoTyLam tyv e) = ( tyv:tyvs, vs, e_after )
496 where (tyvs, vs, e_after) = collect_tyvars e
497 collect_tyvars e@(CoLam _ _) = ( [], vss, e_after )
498 where (vss, e_after) = collect_vars e
499 collect_tyvars other_e = ( [], [], other_e )
501 collect_vars (CoLam vars e) = (vars:varss, e_after)
502 where (varss, e_after) = collect_vars e
503 collect_vars other_e = ( [], other_e )
506 pp_varss (vars:varss)
507 = ppCat [ppStr "\\", ppInterleave ppSP (map (pbdr2 sty) vars),
508 ppStr "->", pp_varss varss]
510 pprCoreExpr sty pbdr1 pbdr2 pbdee expr@(CoApp fun_expr atom)
512 (fun, args) = collect_args expr []
514 ppHang (pprParendCoreExpr sty pbdr1 pbdr2 pbdee fun)
515 4 (ppSep (map (pprCoreAtom sty pbdee) args))
517 collect_args (CoApp fun arg) args = collect_args fun (arg:args)
518 collect_args fun args = (fun, args)
520 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoTyApp expr ty)
521 = ppHang (ppBeside pp_note (pprParendCoreExpr sty pbdr1 pbdr2 pbdee expr))
522 4 (pprParendUniType sty ty)
524 pp_note = ifPprShowAll sty (ppStr "{-CoTyApp-} ")
526 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoCase expr alts)
527 = ppSep [ppSep [ppStr "case", ppNest 4 (pprParendCoreExpr sty pbdr1 pbdr2 pbdee expr),
529 ppNest 2 (pprCoreCaseAlts sty pbdr1 pbdr2 pbdee alts),
532 -- special cases: let ... in let ...
533 -- ("disgusting" SLPJ)
535 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoLet bind@(CoNonRec binder rhs@(CoLet _ _)) body)
537 ppCat [ppStr "let {", pbdr1 sty binder, ppEquals],
538 ppNest 2 (pprCoreExpr sty pbdr1 pbdr2 pbdee rhs),
540 pprCoreExpr sty pbdr1 pbdr2 pbdee body ]
542 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoLet bind@(CoNonRec binder rhs) expr@(CoLet _ _))
544 (ppHang (ppStr "let {")
545 2 (ppCat [ppHang (ppCat [pbdr1 sty binder, ppEquals])
546 4 (pprCoreExpr sty pbdr1 pbdr2 pbdee rhs),
548 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr)
550 -- general case (recursive case, too)
551 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoLet bind expr)
552 = ppSep [ppHang (ppStr "let {") 2 (pprCoreBinding sty pbdr1 pbdr2 pbdee bind),
553 ppHang (ppStr "} in ") 2 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr)]
555 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoSCC cc expr)
556 = ppSep [ ppCat [ppStr "_scc_", ppStr (showCostCentre sty True{-as string-} cc)],
557 pprParendCoreExpr sty pbdr1 pbdr2 pbdee expr ]
559 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoZfExpr expr quals)
560 = ppHang (ppCat [ppStr "<<" , pprCoreExpr sty pbdr1 pbdr2 pbdee expr , ppStr "|"])
561 4 (ppSep [pprParQuals sty pbdr1 pbdr2 pbdee quals, ppStr ">>"])
563 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoParCon con dim types args)
564 = ppHang (ppBesides [ppr sty con, ppStr "!<<" , ppr sty dim , ppStr ">>"])
565 4 (ppSep ( (map (pprParendUniType sty) types)
566 ++ (map (pprParendCoreExpr sty pbdr1 pbdr2 pbdee) args) ))
568 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoParComm dim expr comType)
569 = ppSep [ppSep [ppStr "COMM",
570 ppNest 2 (pprParendCoreExpr sty pbdr1 pbdr2 pbdee expr),ppStr "{"],
571 ppNest 2 (ppr sty comType),
574 pprCoreExpr sty pbdr1 pbdr2 pbdee (CoParZipWith dim expr exprs)
575 = ppHang (ppBesides [ ppStr "CoParZipWith {" , ppr sty dim , ppStr "}",
576 pprParendCoreExpr sty pbdr1 pbdr2 pbdee expr])
578 #endif {- Data Parallel Haskell -}
582 pprParendCoreExpr sty pbdr1 pbdr2 pbdee e@(CoVar _) = pprCoreExpr sty pbdr1 pbdr2 pbdee e
583 pprParendCoreExpr sty pbdr1 pbdr2 pbdee e@(CoLit _) = pprCoreExpr sty pbdr1 pbdr2 pbdee e
584 pprParendCoreExpr sty pbdr1 pbdr2 pbdee other_e
585 = ppBesides [ppLparen, pprCoreExpr sty pbdr1 pbdr2 pbdee other_e, ppRparen]
589 instance (Outputable bndr, Outputable bdee)
590 => Outputable (CoreCaseAlternatives bndr bdee) where
591 ppr sty alts = pprCoreCaseAlts sty ppr ppr ppr alts
597 -> (PprStyle -> bndr -> Pretty) -- to print "major" binders
598 -> (PprStyle -> bndr -> Pretty) -- to print "minor" binders
599 -> (PprStyle -> bdee -> Pretty) -- to print bindees
600 -> CoreCaseAlternatives bndr bdee
603 pprCoreCaseAlts sty pbdr1 pbdr2 pbdee (CoAlgAlts alts deflt)
604 = ppAboves [ ppAboves (map ppr_alt alts),
605 pprCoreCaseDefault sty pbdr1 pbdr2 pbdee deflt ]
607 ppr_alt (con, params, expr)
608 = ppHang (ppCat [ppr_con con,
609 ppInterleave ppSP (map (pbdr2 sty) params),
611 4 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr)
615 then ppBesides [ppLparen, ppr sty con, ppRparen]
618 pprCoreCaseAlts sty pbdr1 pbdr2 pbdee (CoPrimAlts alts deflt)
619 = ppAboves [ ppAboves (map ppr_alt alts),
620 pprCoreCaseDefault sty pbdr1 pbdr2 pbdee deflt ]
623 = ppHang (ppCat [ppr sty lit, ppStr "->"])
624 4 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr)
627 -- ToDo: niceties of printing
628 -- using special binder/bindee printing funs, rather than just "ppr"
630 pprCoreCaseAlts sty pbdr1 pbdr2 pbdee (CoParAlgAlts tycon dim params alts deflt)
631 = ppAboves [ ifPprShowAll sty (ppr sty tycon),
632 ppBeside (ppCat (map (ppr sty) params))
633 (ppCat [ppStr "|" , ppr sty dim , ppStr "|"]),
634 ppAboves (map (ppr_alt sty) alts),
637 ppr_alt sty (con, expr)
638 = ppHang (ppCat [ppStr "\\/", ppr_con sty con, ppStr "->"])
643 then ppBesides [ppLparen, ppr sty con, ppRparen]
646 pprCoreCaseAlts sty pbdr1 pbdr2 pbdee (CoParPrimAlts tycon dim alts deflt)
647 = ppAboves [ ifPprShowAll sty (ppr sty tycon),
648 ppCat [ppStr "|" , ppr sty dim , ppStr "|"],
649 ppAboves (map (ppr_alt sty) alts),
652 ppr_alt sty (lit, expr)
653 = ppHang (ppCat [ppStr "\\/", ppr sty lit, ppStr "->"]) 4 (ppr sty expr)
655 #endif /* Data Parallel Haskell */
659 instance (Outputable bndr, Outputable bdee)
660 => Outputable (CoreCaseDefault bndr bdee) where
661 ppr sty deflt = pprCoreCaseDefault sty ppr ppr ppr deflt
667 -> (PprStyle -> bndr -> Pretty) -- to print "major" binders
668 -> (PprStyle -> bndr -> Pretty) -- to print "minor" binders
669 -> (PprStyle -> bdee -> Pretty) -- to print bindees
670 -> CoreCaseDefault bndr bdee
673 pprCoreCaseDefault sty pbdr1 pbdr2 pbdee CoNoDefault = ppNil
675 pprCoreCaseDefault sty pbdr1 pbdr2 pbdee (CoBindDefault binder expr)
676 = ppHang (ppCat [pbdr2 sty binder, ppStr "->"])
677 4 (pprCoreExpr sty pbdr1 pbdr2 pbdee expr)
682 instance (Outputable bndr, Outputable bdee)
683 => Outputable (CoreParQuals bndr bdee) where
684 ppr sty qual = pprParQuals sty ppr ppr ppr qual
686 pprParQuals sty pbdr1 pbdr2 pbdee (CoAndQuals x y)
687 = ppAboves [(ppBesides [pprParQuals sty pbdr1 pbdr2 pbdee x , ppComma]) , pprParQuals sty pbdr1 pbdr2 pbdee y]
689 pprParQuals sty pbdr1 pbdr2 pbdee (CoDrawnGen pats pat expr)
691 ppInterleave ppComma (map (ppr sty) pats),
692 ppSemi, ppr sty pat,ppStr "|)",
693 ppStr "<<-", pprCoreExpr sty pbdr1 pbdr2 pbdee expr]
695 pprParQuals sty pbdr1 pbdr2 pbdee (CoIndexGen exprs pat expr)
697 ppInterleave ppComma (map (pprCoreExpr sty pbdr1 pbdr2 pbdee) exprs),
698 ppSemi, ppr sty pat,ppStr "|)",
699 ppStr "<<=", pprCoreExpr sty pbdr1 pbdr2 pbdee expr]
701 pprParQuals sty pbdr1 pbdr2 pbdee (CoParFilter expr)
702 = pprParendCoreExpr sty pbdr1 pbdr2 pbdee expr
703 #endif {- Data Parallel Haskell -}
708 instance (Outputable bndr, Outputable bdee)
709 => Outputable (CoreParCommunicate bndr bdee) where
710 ppr sty c = pprCoreParCommunicate sty ppr ppr ppr c
712 pprCoreParCommunicate sty pbdr1 pbdr2 pbdee (CoParSend fns)
716 (ppAboves (zipWith ppSendFns fns ([1..]::[Int])))
719 = ppCat [ppStr "Dim" , ppr sty dim , ppStr "=" ,
720 pprParendCoreExpr sty pbdr1 pbdr2 pbdee expr ]
722 pprCoreParCommunicate sty pbdr1 pbdr2 pbdee (CoParFetch fns)
726 (ppAboves (zipWith ppSendFns fns ([1..]::[Int])))
729 = ppCat [ppStr "Dim" , ppr sty dim , ppStr "=" ,
730 pprParendCoreExpr sty pbdr1 pbdr2 pbdee expr ]
732 pprCoreParCommunicate sty pbdr1 pbdr2 pbdee (CoToPodized)
733 = ppStr "ConvertToPodized"
735 pprCoreParCommunicate sty pbdr1 pbdr2 pbdee (CoFromPodized)
736 = ppStr "ConvertFromPodized"
737 #endif {- Data Parallel Haskell -}