Local bindings in the static form

Facundo Domínguez facundo.dominguez at tweag.io
Thu Mar 3 19:41:25 UTC 2016

  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)
    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?


[1] https://ghc.haskell.org/trac/ghc/ticket/11656

More information about the ghc-devs mailing list