
Hi Andrew, Andrew Coppin wrote:
You could define a function:
withContainer ∷ (∀ s. Container s → α) → α
which creates a container, parameterizes it with an 's' that is only scoped over the continuation and applies the continuation to the created container.
Hmm, yes. That will work, but I wonder if there's some way of doing this that doesn't limit the scope of the container to one single span of code...
You can write helper functions which take containers as argument by parameterizing these helper functions over s: takesTwoContainers :: Container s1 -> Container s2 -> ... takesTwoContainers c1 c2 = ... -- c1 and c2 can be used here This function could be called like this: withContainer (\c1 -> withContainer (\c2 -> takesTwoContainers c1 c2)) -- c1 and c2 can be used here In this example, the scope of the containers is not limited to a single span of code. Tillmann