
ajb@spamcop.net wrote:
Quoting Gracjan Polak
: [...] Is there any reason why isn't it included?
Nobody could agree on the details. For example, MVars are perfectly respectable Refs on the IO monad. So would it make sense to add an instance for that? If so, the functional dependency should go, which introduces its own problems.
A few more design problems: * Due to the functional dependency, that class is not Haskell98, which is a *very* good reason IMHO not to standardize it, at least in that way. Remember: There are not only GHC and Hugs out there... * The 3 operations should not be packed together in a single class, because there might be e.g. references which you can't create (e.g. OpenGL's state variables), references which are read-only and even references which are write-only. * What about strictness of e.g. the setter? There is no "right" version, this depends on the intended usage. * Are the references located in the monad (like in the suggested class) or are they within objects, which have to be given as additional arguments (e.g. like wxHaskell's widgets/Attr/Prop). * Atomic operations might be needed, too. Cheers, S.