On 23 February 2011 15:40, Kurt Stutsman <[email protected]> wrote:
> 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.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe