
23 Feb
2011
23 Feb
'11
10:53 a.m.
On 23 February 2011 15:40, Kurt Stutsman
instance Enum e => Serializable e where get mask = {- convert mask to Int and then to a BitSet -} put bitset = {- convert BitSet to Int and then to String -}
I looks like all you need is for objects to be enumerable, i.e have instances of Enum. So instead of the above class, can you manage with these two functions? get :: Enum e => e -> Int put :: BitSet -> String Type classes give you type-based dispatch - *but* they are overkill if you don't actually need type-base dispatch.