[Haskell-cafe] Efficient Sets for Small Enumerations

2006-04-03 Thread David F. Place
Often when writing algorithms which involve set operations on small enumerations, I start off using Data.Set. I soon find performance requires rewriting that code to use bitwise operations. I miss the nice interface of Data.Set and the type checking of using a proper data type. So, as

Re: [Haskell-cafe] Efficient Sets for Small Enumerations

2006-04-03 Thread Benjamin Franksen
On Monday 03 April 2006 14:19, David F. Place wrote: Often when writing algorithms which involve set operations on small enumerations, I start off using Data.Set. I soon find performance requires rewriting that code to use bitwise operations. I miss the nice interface of Data.Set and the

Re: [Haskell-cafe] Efficient Sets for Small Enumerations

2006-04-03 Thread David F. Place
On Apr 3, 2006, at 1:31 PM, Benjamin Franksen wrote: wondered about the Ord instance. Wouldn't it be faster to compare (word-) representations? I thought about that some. Since the set representation is based completely on the enumeration, it would be possible for the type being

Re: [Haskell-cafe] Efficient Sets for Small Enumerations

2006-04-03 Thread Jean-Philippe Bernardy
On 4/3/06, David F. Place [EMAIL PROTECTED] wrote: On Apr 3, 2006, at 1:31 PM, Benjamin Franksen wrote: wondered about the Ord instance. Wouldn't it be faster to compare (word-) representations? I thought about that some. Since the set representation is based completely on the

Re: [Haskell-cafe] Efficient Sets for Small Enumerations

2006-04-03 Thread David F. Place
On Apr 3, 2006, at 5:38 PM, Jean-Philippe Bernardy wrote: I don't think there is a requirement for the Ord class to be equal to compare a b = compare (toAscList a) (toAscList b). I'd say it's safe to simply compare the bits representation. Hmm. OK. Besides, I've integrated your module to