Ticket #8201: 0002-Haddokifying-HsExpr.patch

File 0002-Haddokifying-HsExpr.patch, 6.8 KB (added by DaniilFrumin, 2 years ago)
  • compiler/hsSyn/HsExpr.lhs

    From 85a12861a9403df90b70c311f415395f1ed61bd5 Mon Sep 17 00:00:00 2001
    From: Dan Frumin <[email protected]>
    Date: Fri, 30 Aug 2013 11:44:47 +0000
    Subject: [PATCH 2/2] Haddokifying HsExpr
    
    ---
     compiler/hsSyn/HsExpr.lhs |   60 +++++++++++++++++++++++++++------------------
     1 file changed, 36 insertions(+), 24 deletions(-)
    
    diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs
    index ccbfc63..27286ca 100644
    a b is Less Cool because 
    121121\begin{code}
    122122-- | A Haskell expression.
    123123data HsExpr id
    124   = HsVar     id                        -- ^ variable
    125   | HsIPVar   HsIPName                  -- ^ implicit parameter
     124  = HsVar     id                        -- ^ Variable
     125  | HsIPVar   HsIPName                  -- ^ Implicit parameter
    126126  | HsOverLit (HsOverLit id)            -- ^ Overloaded literals
    127127
    128128  | HsLit     HsLit                     -- ^ Simple (non-overloaded) literals
    129129
    130   | HsLam     (MatchGroup id (LHsExpr id)) -- Currently always a single match
     130  | HsLam     (MatchGroup id (LHsExpr id)) -- ^ Lambda abstraction. Currently always a single match
    131131
    132   | HsLamCase PostTcType (MatchGroup id (LHsExpr id)) -- Lambda-case
     132  | HsLamCase PostTcType (MatchGroup id (LHsExpr id)) -- ^ Lambda-case
    133133
    134   | HsApp     (LHsExpr id) (LHsExpr id) -- Application
     134  | HsApp     (LHsExpr id) (LHsExpr id) -- ^ Application
    135135
    136   -- Operator applications:
     136  -- | Operator applications:
    137137  -- NB Bracketed ops such as (+) come out as Vars.
    138138
    139139  -- NB We need an expr for the operator in an OpApp/Section since
    data HsExpr id 
    144144                Fixity          -- Renamer adds fixity; bottom until then
    145145                (LHsExpr id)    -- right operand
    146146
    147   | NegApp      (LHsExpr id)    -- negated expr
    148                 (SyntaxExpr id) -- Name of 'negate'
     147  -- | Negation operator. Contains the negated expression and the name
     148  -- of 'negate'             
     149  | NegApp      (LHsExpr id)
     150                (SyntaxExpr id)
    149151
    150   | HsPar       (LHsExpr id)    -- Parenthesised expr; see Note [Parens in HsSyn]
     152  | HsPar       (LHsExpr id)    -- ^ Parenthesised expr; see Note [Parens in HsSyn]
    151153
    152154  | SectionL    (LHsExpr id)    -- operand; see Note [Sections in HsSyn]
    153155                (LHsExpr id)    -- operator
    154156  | SectionR    (LHsExpr id)    -- operator; see Note [Sections in HsSyn]
    155157                (LHsExpr id)    -- operand
    156158
    157   | ExplicitTuple               -- Used for explicit tuples and sections thereof
     159  -- | Used for explicit tuples and sections thereof
     160  | ExplicitTuple               
    158161        [HsTupArg id]
    159162        Boxity
    160163
    data HsExpr id 
    168171                (LHsExpr id)    --  then part
    169172                (LHsExpr id)    --  else part
    170173
    171   | HsMultiIf   PostTcType [LGRHS id (LHsExpr id)] -- Multi-way if
     174  -- | Multi-way if
     175  | HsMultiIf   PostTcType [LGRHS id (LHsExpr id)]
    172176
    173   | HsLet       (HsLocalBinds id) -- let(rec)
     177  -- | let(rec)
     178  | HsLet       (HsLocalBinds id)
    174179                (LHsExpr  id)
    175180
    176181  | HsDo        (HsStmtContext Name) -- The parameterisation is unimportant
    data HsExpr id 
    179184                [ExprLStmt id]       -- "do":one or more stmts
    180185                PostTcType           -- Type of the whole expression
    181186
    182   | ExplicitList                        -- syntactic list
     187  -- | Syntactic list: [a,b,c,...]
     188  | ExplicitList                       
    183189                PostTcType              -- Gives type of components of list
    184190                (Maybe (SyntaxExpr id)) -- For OverloadedLists, the fromListN witness
    185191                [LHsExpr id]
    186192
    187   | ExplicitPArr                -- syntactic parallel array: [:e1, ..., en:]
     193  -- | Syntactic parallel array: [:e1, ..., en:]
     194  | ExplicitPArr               
    188195                PostTcType      -- type of elements of the parallel array
    189196                [LHsExpr id]
    190197
    191   -- Record construction
     198  -- | Record construction
    192199  | RecordCon   (Located id)       -- The constructor.  After type checking
    193200                                   -- it's the dataConWrapId of the constructor
    194201                PostTcExpr         -- Data con Id applied to type args
    195202                (HsRecordBinds id)
    196203
    197   -- Record update
     204  -- | Record update
    198205  | RecordUpd   (LHsExpr id)
    199206                (HsRecordBinds id)
    200207--              (HsMatchGroup Id)  -- Filled in by the type checker to be
    data HsExpr id 
    207214  -- For a type family, the arg types are of the *instance* tycon,
    208215  -- not the family tycon
    209216
    210   | ExprWithTySig                       -- e :: type
     217  -- | Expression with an explicit type signature. @e :: type@ 
     218  | ExprWithTySig                       
    211219                (LHsExpr id)
    212220                (LHsType id)
    213221
    data HsExpr id 
    216224                (LHsType Name)          -- Retain the signature for
    217225                                        -- round-tripping purposes
    218226
    219   | ArithSeq                            -- Arithmetic sequence
     227  -- | Arithmetic sequence
     228  | ArithSeq                           
    220229                PostTcExpr
    221230                (Maybe (SyntaxExpr id))   -- For OverloadedLists, the fromList witness
    222231                (ArithSeqInfo id)
    223232
    224   | PArrSeq                             -- arith. sequence for parallel array
     233  -- | Arithmetic sequence for parallel array
     234  | PArrSeq                             
    225235                PostTcExpr              -- [:e1..e2:] or [:e1, e2..e3:]
    226236                (ArithSeqInfo id)
    227237
    data HsExpr id 
    250260  -----------------------------------------------------------
    251261  -- Arrow notation extension
    252262
     263  -- | @proc@ notation for Arrows
    253264  | HsProc      (LPat id)               -- arrow abstraction, proc
    254265                (LHsCmdTop id)          -- body of the abstraction
    255266                                        -- always has an empty stack
    data HsExpr id 
    315326  |  HsUnboundVar RdrName
    316327  deriving (Data, Typeable)
    317328
    318 -- HsTupArg is used for tuple sections
     329-- | HsTupArg is used for tuple sections
    319330--  (,a,) is represented by  ExplicitTuple [Mising ty1, Present a, Missing ty3]
    320331--  Which in turn stands for (\x:ty1 \y:ty2. (x,a,y))
    321332data HsTupArg id
    322   = Present (LHsExpr id)        -- The argument
    323   | Missing PostTcType          -- The argument is missing, but this is its type
     333  = Present (LHsExpr id)        -- ^ The argument
     334  | Missing PostTcType          -- ^ The argument is missing, but this is its type
    324335  deriving (Data, Typeable)
    325336
    326337tupArgPresent :: HsTupArg id -> Bool
    327338tupArgPresent (Present {}) = True
    328339tupArgPresent (Missing {}) = False
    329340
    330 type PendingSplice = (Name, LHsExpr Id) -- Typechecked splices, waiting to be
    331                                         -- pasted back in by the desugarer
     341-- | Typechecked splices, waiting to be
     342-- pasted back in by the desugarer
     343type PendingSplice = (Name, LHsExpr Id)
    332344
    333345\end{code}
    334346