On Sat, Mar 8, 2008 at 9:23 PM, Brandon S. Allbery KF8NH > I think you might be able to do this as a typeclass instead, at the > expense of having to insert an instance declaration for each type. > (You will have to use an extension if you want to declare instances > for types such as Int. I think.) > > class (Bounded a, Enum a) => BoundedEnum a where -- empty > > instance BoundedEnum MyType a where > instance BoundedEnum Int where -- requires FlexibleInstances?
I've had good luck with things like: class (Bounded a, Enum a) => BoundedEnum a instance (Bounded a, Enum a) => BoundedEnum a which picks up everything that can inhabit the new class. -Antoine _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
