Ryan Ingram wrote:
Congratulations, you're halfway to reinventing ST! :)
Except that, AFAIK, ST doesn't provide the "hey you can store anything
and retrieve it later" trick. ;-)
I did however wonder if there wasn't some way I could use an extra
phantom type to somehow "tag" which thread a key was generated in... but
I couldn't figure out how to make it work.
Here's the "trick" [1]:
data Storage s x
...
data Key s v
...
Now add the extra "s" parameter to all the functions that use Storage & Key.
run :: (forall s. Storage s x) -> x
Now you can't save keys between sessions; the type "s" isn't allowed
to escape the "forall" on the left of the function arrow!
Ah, I see. It sounds so easy when you already know how... :-)
BTW, does anybody know how rank-N types are different from existential
types?
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe