The Set type

2000-12-04 Thread George Russell

A minor quibble I know, but every time I use sets I want to add/subtract single 
elements
to/from them.  There is no function provided for doing this, so instead you have to do
union/delete with a singleton set constructed from the element.  I appreciate the zeal
of the designer of this module to construct the smallest possible interface (I wish the
same person had designed the standard Prelude) but I think this zeal is overdone.
You do often need to operate with single elements.  After all, if you wanted real 
hair-shirt minimalism you should get rid of "elementOf" (replace it by 
\el set - isEmptySet (intersect set (singletonSet el)), but no-one would seriously
suggest that - I hope.

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Or-patterns

2000-12-04 Thread George Russell

Why not steal a good idea from Standard ML/New Jersey now and again?  This has
"Or-patterns" which allow you to match against a disjunction of patterns,
EG

fun sleepIn (Date.Sat | Date.Sun) = true
|   sleepIn _ = false

Where you have variables in the patterns, you bind only the variables which appear 
in all the patterns, and you unify the types accordingly.

Of course you can do without this feature, but I feel it shouldn't be too hard
to implement and for me at least it would be occasionally useful.

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users