Typesafe MRef with a regular monad

Ralf Hinze ralf@informatik.uni-bonn.de
Mon, 16 Jun 2003 10:31:28 +0200


> Yes, that's a good point.  So there are really three issues:
>         a) single-threaded-ness
>         b) making sure you look up in the right map
>         c) making sure the thing you find has the right type
>
> Even if you have typed keys, (Key a), then if you look them up in the
> wrong map, any guarantee that it maps to a value of type 'a' is out of
> the window.

Not true, if you use the finite map implementation based on dynamics.
Here, the story is: with single-threaded-ness you can omit the dynamic
type checks (they are guaranteed to succeed); if you use finite maps
in a persistent manner, this is no longer true.

Cheers, Ralf