[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / coreSyn / TaggedCore.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
3 %
4 \section[TaggedCore]{``Tagged binder'' core syntax (including \tr{Simplifiable*})}
5
6 This module defines a particular parameterisation of the @CoreSyntax@
7 data type.  For ``binders,'' we use a pair: an @Id@ (the actual
8 binder) and a ``tag''---any old thing we want to pin on.
9 Bindees are @Ids@, as usual.
10
11 By far the prevalent use is with a ``tag'' of a @BinderInfo@, as used
12 in the simplifier.  So we have a full swatch of synonyms for
13 \tr{Simplifiable} this and that.
14
15 \begin{code}
16 #include "HsVersions.h"
17
18 module TaggedCore (
19         TaggedBinder(..), TaggedCoreBinding(..), TaggedCoreExpr(..),
20         TaggedCoreAtom(..), TaggedCoreCaseAlternatives(..),
21         TaggedCoreCaseDefault(..),
22 #ifdef DPH
23         TaggedCoreParQuals(..),
24         TaggedCoreParCommunicate(..),
25         CoreParCommunicate(..),
26         CoreParQuals(..),
27 #endif
28         unTagBinders, unTagBindersAlts,
29
30         CoreArg(..), applyToArgs, decomposeArgs, collectArgs,
31
32         SimplifiableBinder(..), SimplifiableCoreBinding(..),
33         SimplifiableCoreExpr(..), SimplifiableCoreAtom(..),
34         SimplifiableCoreCaseAlternatives(..),
35         SimplifiableCoreCaseDefault(..),
36 #ifdef DPH
37         SimplifiableCoreParQuals(..),
38         SimplifiableCoreParCommunicate(..),
39 #endif
40
41         CoreBinding(..), CoreExpr(..),  CoreAtom(..), -- re-exported
42         CoreCaseAlternatives(..), CoreCaseDefault(..),
43
44         -- and to make the interface self-sufficient ...
45         Outputable(..), NamedThing(..),
46         ExportFlag, Pretty(..), PprStyle, PrettyRep,
47
48         BasicLit, BinderInfo, GlobalSwitch, Id, PrimOp, CostCentre,
49         SrcLoc, TyCon, TyVar, UniType, Unique
50     ) where
51
52 import CoreFuns         ( unTagBinders, unTagBindersAlts, digForLambdas )
53 import CoreSyn          -- mostly re-exporting this stuff
54 import BinderInfo       ( BinderInfo )
55 import Outputable
56 import Util
57 \end{code}
58
59 \begin{code}
60 type TaggedBinder tag = (Id, tag)
61
62 type TaggedCoreProgram tag = [CoreBinding (TaggedBinder tag) Id]
63 type TaggedCoreBinding tag =  CoreBinding (TaggedBinder tag) Id
64 type TaggedCoreExpr    tag =  CoreExpr    (TaggedBinder tag) Id
65 type TaggedCoreAtom    tag =  CoreAtom                       Id
66
67 #ifdef DPH
68 type TaggedCoreParQuals tag = CoreParQuals (TaggedBinder tag) Id
69 type TaggedCoreParCommunicate tag
70   = CoreParCommunicate (TaggedBinder tag) Id
71 #endif {- Data Parallel Haskell -}
72
73 type TaggedCoreCaseAlternatives tag = CoreCaseAlternatives (TaggedBinder tag) Id
74 type TaggedCoreCaseDefault tag = CoreCaseDefault (TaggedBinder tag) Id
75 \end{code}
76
77 \begin{code}
78 type SimplifiableBinder = (Id, BinderInfo)
79
80 type SimplifiableCoreProgram = [CoreBinding SimplifiableBinder Id]
81 type SimplifiableCoreBinding =  CoreBinding SimplifiableBinder Id
82 type SimplifiableCoreExpr    =  CoreExpr    SimplifiableBinder Id
83 type SimplifiableCoreAtom    =  CoreAtom                       Id
84
85 #ifdef DPH
86 type SimplifiableCoreParQuals = CoreParQuals SimplifiableBinder Id
87 type SimplifiableCoreParCommunicate
88   = CoreParCommunicate SimplifiableBinder Id
89 #endif {- Data Parallel Haskell -}
90
91 type SimplifiableCoreCaseAlternatives = CoreCaseAlternatives SimplifiableBinder Id
92 type SimplifiableCoreCaseDefault      = CoreCaseDefault SimplifiableBinder Id
93 \end{code}