Typesafe MRef with a regular monad

Carl R. Witty cwitty@newtonlabs.com
13 Jun 2003 13:35:27 -0700


Keith Wansbrough <Keith.Wansbrough@cl.cam.ac.uk> writes:

> > In article <v4j7k7qsp5c.fsf@newtonlabs.com>,
> >  cwitty@newtonlabs.com (Carl R. Witty) wrote:
> > 
> > > Here's a hand-waving argument that you need either Typeable (or
> > > something else that has a run-time concrete representation of types)
> > > or ST/STRef (or something else, probably monadic, that can track
> > > unique objects) to do this.
> > 
> > George Russell already showed this, didn't he? You can implement 
> > Typeable given type-safe MRefs, and you can implement type-safe MRefs 
> > given Typeable.
> 
> But George Russell's implementation relied on looking up something in
> one map with a key obtained from another map.  I thought type-safe
> MRefs should disallow this.

If you use Simon PJ's type signatures, you can't really disallow using
a key from one map with another map.

Carl Witty