
Warning about the use of (:=): This symbol has been proposed by John Hughes for use in some future version of Haskell to distinguish monomorphic and polymorphic `let` constructs. (See, for example, http://www.math.chalmers.se/~rjmh/Globals.ps , section 6.) You might prefer to choose a different symbol, such as (:==) or (::=). Thanks for mentioning this. However, (:=) is a rather attractive constructor to use and I wonder if a monomorphic binding is used enoug to justify taking another operator away. It might be better after all to have a family of "let" bindings in a future haskell: let -- lazy bindinglet! -- strict bindinglet$ -- speculative binding (ie. try operationally strictly but maintain lazy semantics)let# -- monomorphic binding ?... -- Daan. Dean Daan Leijen wrote: > 2. The := operator. > The =: function should say "assign to this property". Is seems to be the > wrong way round. Is it possible to use the constructor := , or is this > conceptionally difficult?Great plan. I tried it in my upcoming wxWindows-GIO library, and foundthat I needed existential types. Not a problem since we are GHCdependent anyway :-) (well, maybe not, NHC is getting really good these days).Anyway, I defined: data Attr w a = Attr (w -> IO a) (w -> a -> IO ()) -- getter and setterdata Prop w = forall a. (:=) (Attr w a) a -- := is a constructorset :: w -> [Prop w] -> IO () set w props = mapM_ setProp props where setProp ((Attr getter setter) := x) = setter w xget :: w -> Attr w a -> IO a get w (Attr getter setter) = getter w-- example of an attribute, works for any kind of (wxWindows) Frame title :: Attr (Frame a) String title = Attr (\w -> w # frameGetTitle) (\w x -> w # frameSetTitle x)...gui = do ... set frame [title := "hi there"] Really nice!, thanks for sparking the idea. Nice application of existential types too.