Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Instances for IORef/TVar/MVar and other mutable containers #6
I'd like to propose the following instances:
I think forcing a mutable container should not force the contained value, since that is not really "part" of the data type, it is just referenced. The instances are nevertheless useful when working with APIs that expect NFData types, for example criterion.
Makes sense to me.
Way down in the guts of
STRef is basically a data box that carries around a reference to that MutVar#, and it delegates to the underlying MutVar# for its identity, etc.
My guess/assumption is that it is always strict, warranting the # kind, but it might be worth double checking with someone who can give a more authoritative answer, e.g. Simon Marlow.
Thanks. That'll help simplify the code I have for forcing all the way down to them in my not-yet-released
In my case I have a
Previously I was walking all the way down to the MutVar#, but if I can stop at the STRef constructor in the forcing pass it'll save a little bit of work.
Fritz Henglein wrote a couple of papers on this idea (among others) in a more general setting.
@glguy tbh, I don't like to sacrifice
maybe we could just have the
maybe at some point in the future