Local bindings in the static form

Simon Peyton Jones simonpj at microsoft.com
Thu Mar 10 21:51:40 UTC 2016


Eeek. That looks wrong.  I've created https://ghc.haskell.org/trac/ghc/ticket/11698.

The fix isn't hard, but I'm busy writing papers.  I can explain what to do if you are minded to do it.  The good thing is that it would then do what you want too!

Simon

| -----Original Message-----
| From: facundominguez at gmail.com [mailto:facundominguez at gmail.com] On Behalf Of
| Facundo Domínguez
| Sent: 07 March 2016 20:55
| To: Simon Peyton Jones <simonpj at microsoft.com>
| Cc: ghc-devs at haskell.org
| Subject: Re: Local bindings in the static form
| 
| Hello Simon,
| 
| We considered tct_closed once. However, it only seems to indicate
| whether the type of a binding is closed, instead of its right hand
| side.
| 
| For instance,
| 
| \x -> let g = x :: Int in g
| 
| In this example, g would have a closed type Int, thus tct_closed ==
| TopLevel. However, the right hand side of g has a free variable x
| which is not bound at the top level, and therefore it couldn't be
| floated out.
| 
| Corrections are welcome if I'm fooling myself in some aspect here.
| 
| Thanks,
| Facundo
| 
| 
| On Fri, Mar 4, 2016 at 7:47 AM, Simon Peyton Jones
| <simonpj at microsoft.com> wrote:
| > Facundo
| >
| > Yes, that makes perfect sense.  Moreover, it is pretty much exactly what
| the tct_closed flag on `ATcId` does.
| >
| > The trick will be to guarantee that all those Ids do in fact end up being
| floated out.
| >
| > We could have a Skype chat about this, preferably after the March 16 ICFP
| deadline
| >
| > Simon
| >
| > |  -----Original Message-----
| > |  From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of
| > |  Facundo Domínguez
| > |  Sent: 03 March 2016 19:41
| > |  To: ghc-devs at haskell.org
| > |  Subject: Local bindings in the static form
| > |
| > |  Hello,
| > |    At Tweag I/O we are considering relaxing a bit the constraints on the
| > |  static form.
| > |
| > |  static <exp>
| > |
| > |    demands <exp> to be closed. That is, the free variables of <exp> must
| > |  be bound at the top level.
| > |
| > |  However, it would be fine to allow local bindings too. For instance:
| > |
| > |  test :: StaticPtr ([[Int]] -> [[Int]])
| > |  test x = static (filter hasZero)
| > |    where
| > |      hasZero = any isZero
| > |      isZero  = (0 ==)
| > |
| > |  Where hasZero is local but its body can be considered kind of closed
| > |  (all free variables refer to top-level bindings or other *closed* local
| > |  bindings.).
| > |
| > |  We would need for this implementation a way to test closedness in this
| > |  sense. Could there be any similar test implemented already in GHC?
| > |
| > |  Thanks,
| > |  Facundo
| > |
| > |  [1] https://ghc.haskell.org/trac/ghc/ticket/11656
| > |  _______________________________________________
| > |  ghc-devs mailing list
| > |  ghc-devs at haskell.org
| > |  https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.ha
| > |  skell.org%2fcgi-bin%2fmailman%2flistinfo%2fghc-
| > |  devs&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7cead97b273efa41c1
| > |  a49608d3439bd142%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=Z1TbBcSgd
| > |  YLZ%2bXrMJVMvqJIfwc4R2kLeRaPPwuQ5%2fLQ%3d


More information about the ghc-devs mailing list