[Git][ghc/ghc][wip/expand-do] - Note changes. Making expansion example a bit more complex

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Mon Nov 6 11:24:27 UTC 2023



Apoorv Ingle pushed to branch wip/expand-do at Glasgow Haskell Compiler / GHC


Commits:
a142de1d by Apoorv Ingle at 2023-11-06T12:22:06+01:00
- Note changes. Making expansion example a bit more complex

- - - - -


1 changed file:

- compiler/GHC/Tc/Gen/Do.hs


Changes:

=====================================
compiler/GHC/Tc/Gen/Do.hs
=====================================
@@ -410,15 +410,17 @@ It stores the original statement (with location) and the expanded expression
   -----------------------------
   For example, the `do`-block
 
-      do { e1;  e2 }
+      do { e1;  e2; e3 }
 
   expands (ignoring the location info) to
 
-      ‹ExpandedThingRn do { e1; e2 }›                               -- Original Do Expression
+      ‹ExpandedThingRn do { e1; e2; e3 }›                        -- Original Do Expression
                                                                  -- Expanded Do Expression
-          (‹ExpandedThingRn e1›                                     -- Original Statement
-                        ({(>>) e1}                               -- Expanded Expression
-                            ‹PopErrCtxt› (‹ExpandedThingRn e2› {e2})))
+          (‹ExpandedThingRn e1›                                  -- Original Statement
+               ({(>>) e1}                                        -- Expanded Expression
+                  ‹PopErrCtxt› (‹ExpandedThingRn e2›
+                         ({(>>) e2}
+                            ‹PopErrCtxt› (‹ExpandedThingRn e3› {e3})))))
 
   * Whenever the typechecker steps through an `ExpandedThingRn`,
     we push the original statement in the error context, set the error location to the
@@ -457,9 +459,9 @@ It stores the original statement (with location) and the expanded expression
   expands (ignoring the location information) to
 
      ‹ExpandedThingRn do{ p <- e1; e2 }›                                      -- Original Do Expression
-                                                                           --
+                                                                              --
          (‹ExpandedThingRn (p <- e1)›                                         -- Original Statement
-                        (((>>=) e1)                                        -- Expanded Expression
+                        (((>>=) e1)                                           -- Expanded Expression
                            ‹PopErrCtxt› ((\ p -> ‹ExpandedThingRn (e2)› e2)))
          )
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a142de1d44d78e97335704317c425b58e61a58e3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a142de1d44d78e97335704317c425b58e61a58e3
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231106/3781f11d/attachment-0001.html>


More information about the ghc-commits mailing list