Combining type constraints

8 Aug
2002
8 Aug
'02
9:54 p.m.
G'day all. I have a large number of functions all of which use the same set of type constraints, such as:
foo :: (Monad m, Ord t, Show t) => ...
Ideally, I'd like to combine them into one typeclass. At the moment, I'm using the equivalent of:
class (Monad m, Ord t, Show t) => Constraints m t where { } instance (Monad m, Ord t, Show t) => Constraints m t where { }
foo :: (Constraints m t) => ...
This requires undecidable instances. Is there a way to do this that doesn't require non-98 features apart from multi-parameter type classes? If not, is there an argument for a language construction which supports this idiom, analogous to type synonyms, except for type classes? Cheers, Andrew Bromage
8321
Age (days ago)
8321
Last active (days ago)
0 comments
1 participants
participants (1)
-
Andrew J Bromage