One way to solve your problem without too much typing is to create a new type class similar to Enum
. Let's call it Enumerable
:
class Enumerable a where
fromEnumerable :: a -> Int
You can then write the instance for Enumerable
using Enum
:
instance Enumerable H3DGeoRes where
fromEnumerable x = fromEnum x + 200
Whenever using the enumeration of your types H3DGeoRes
and H3DAnimRes
you will have to use the functions from the Enumerable
class and not the Enum
class. This is a little bit of a nuisance as it will prevent you from using the convenient list syntax for Enum
.