
This is a real world example of a gui that I am having trouble conceptualizing in haskell. The problem is as follows: There is a list of object instances. Each object has a makeInstance function which displays an interface to an instance. Changes to the interface update the object and all interfaces. Changes to the object update all interfaces. An example of such an object would be an Int. The Int is interfaced by an spinbox. Another object could be an array. It would be represented by two spinboxes (index and value). Here is the c++ solution: class Object { public: virtual shared_ptr<Widget> make_interface()=0; private: signal onChange; public: void doOnChange( function<void> functionToDo ) //... }; class Int { private: int m_int; public: int getVal() { return m_int; } void setVal( int i) { m_int = i; onChange(); //Calls callbacks } virtual shared_ptr<Widget> make_interface() { shared_ptr< SpinBox > spinbox = new Spinbox(); spinbox.set_getter( getVal ); spinbox.set_setter( setVal ); doOnChange( bind( &Spinbox, SpinBox::refresh ) ); } }; What would a haskell solution look like? In my opinion this functionality would be very desirable if not required. David J. Sankel