RE: Typesafe MRef with a regular monad
Yes, one *could* use dynamic types. But the check would always succeed! That suggests a lack in the static type system. It's not surprising: the soundness depends on the un-forgeability of keys. So it's reasonable that there should be some language extension. I'm just looking for the minimal such extension. Finite maps see a bit of a big hammer. Simon | -----Original Message----- | From: Ralf Hinze [mailto:ralf@informatik.uni-bonn.de] | Sent: 06 June 2003 14:29 | To: Simon Peyton-Jones; Tim Sweeney; haskell@haskell.org; Ashley Yakeley | Subject: Re: Typesafe MRef with a regular monad | | Am Freitag, 6. Juni 2003 15:23 schrieb Simon Peyton-Jones: | > Oh bother, I forgot to add that you can of course insert a new value | > with an old key (suitably typed) and have it overwrite. Else, as you | > say, there would not be much point. | > | > Maybe it'd be better to have a separate key-construction function | > newKey :: k -> Key k a | > instead of having insert return a key. | > | > S | | Seriously, isn't this just an application of dynamics? The key | type allows us to insert a cast when looking up a data structure | of dynamic values? | | Cheers, Ralf |
Am Freitag, 6. Juni 2003 15:47 schrieb Simon Peyton-Jones:
Yes, one *could* use dynamic types. But the check would always succeed!
Why is that? If I overwrite an entry with a value of a different type, then the check fails. I am certainly missing something ... Cheers, Ralf
participants (2)
-
Ralf Hinze -
Simon Peyton-Jones