You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I learned that the meaning of specs of local bindings can depend on arguments of an enclosing function. For instance, in the following function from the test suite, arg0 is available to the spec of bar.
{-@ foo:: x:_-> y:_-> {v:Int | v = x + y} @-}
foo::Int->Int->Int
foo arg0 = bar
where
{-@ bar:: x:_-> {v:Int | v = x + arg0} @-}
bar arg1 = arg0 + arg1
It doesn't work for other things than arguments though, e.g. z is not in scope in the following spec.
{-@ foo:: x:_-> y:_-> {v:Int | v = x + y} @-}
foo::Int->Int->Int
foo arg0 = bar
where
z = arg0
{-@ bar:: x:_-> {v:Int | v = x + z} @-}
bar arg1 = arg0 + arg1
@ranjitjhala, should the fact that arguments of enclosing functions are in scope be documented?
The text was updated successfully, but these errors were encountered:
I think that bindings are in scope only if GHC doesn't consider them deadcode. This is because when we get to analyse the desugared program, GHC has already pruned unused bindings.
Today I learned that the meaning of specs of local bindings can depend on arguments of an enclosing function. For instance, in the following function from the test suite,
arg0
is available to the spec ofbar
.It doesn't work for other things than arguments though, e.g.
z
is not in scope in the following spec.@ranjitjhala, should the fact that arguments of enclosing functions are in scope be documented?
The text was updated successfully, but these errors were encountered: