[Haskell-cafe] Type trickery
la at iki.fi
Wed Mar 16 15:06:58 CET 2011
On Wed, Mar 16, 2011 at 12:05:56PM +0000, Andrew Coppin wrote:
> >withContainer ∷ (∀ s. Container s → α) → α
> 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 just pack the container into an existential and pass that
around freely. Only the use of cursors is limited into a scope where
the owning container's type variable is visible (which you get by
unpacking the existential).
More information about the Haskell-Cafe