[GUI] get and set

Sven Panne Sven.Panne@informatik.uni-muenchen.de
Mon, 17 Feb 2003 22:44:26 +0100

Krasimir Angelov wrote:
 > [...] Unfortunately proper implementation requires functional
 > dependencies.

Hmmm, this is really a bit unfortunate, because I wanted to stay
within the realms of Haskell 98 for HOpenGL. GHC and Hugs support this
extension, but NHC98 doesn't even have MPTC, IIRC. But we'll always
have #ifdef...   :-]

Another issue is the quality of the error messages, but after a little
experimentation I found them quite bearable.

 > The attached module contains definitions for get and set functions
 > for IO, ST, Reader, ReaderT, State, StateT, RWS and RWST monads. The
 > idea is that each monad can maintains some kind of state and the
 > corresponding Attr type gives access to some part of the state.

Cool! Only a few minor points:

* It's a bit strange that a class with a "get" method is called
   "Readable". "HasGetter" or "Gettable" would look more consistent to
   me, but I'm not a native speaker.

* A list version of (=:) is missing (called "set" in GIO/HOpenGL). But
   even its type wouldn't be clear to me given this general version of
   (=:). Hmmm...

* Some people have already mentioned that "=:" may be a bit misleading,
   so a different operator may be appropriate. But not ":=" at the price
   of even more non-standard typing!

 > [...] I propose to standardize this concept and add Attr module to
 > the GHC base package.

That was my intention. We should probably move this thread to the
libraries list and continue discussion there (e.g. naming, where
should the classes and instances reside in the module hierarchy,

Krasimir: Do you want to propose your Attr module there (without the
GIO/HOpenGL stuff, of course)? It's your baby, after all...