David Roundy <[EMAIL PROTECTED]> writes: > > 7. Unordered records: yep (if I understand the problem correctly) > > I don't think you understood correctly. What I'd like (and this is another > one of those David-specific issues--I've never heard anyone else complain > about this) is to be able to create a data type that has no order.
FWIW, there are certainly other people out there who think the same way. In the Blobs diagram editor for instance, there are lots of instances of exported datatypes with exported field accessors/updaters, but the constructors are not exported. e.g. module M (FooBar(), emptyFooBar, getFoo, getBar, setFoo, setBar) where data FooBar = FooBar { foo :: String, bar :: Bool } emptyFooBar = FooBar {} getFoo = foo getBar = bar setFoo f fb = fb {foo=f} setBar b fb = fb {bar=b} This gives you three-quarters of your desire, i.e. unordered construction is possible, positional construction is not, and positional de-construction (pattern-matching) is also unavailable. The only thing lacking is the ability to do unordered pattern-matching, which is impossible here because the accessors are pure functions, not true field names. Just as for you, the intent of the design pattern here is total data encapsulation - to be able to change the internals of the FooBar type without any of the importing modules needing to change as a result. Regards, Malcolm _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell