- May 8, 2005
- 415
- 0
- 76
Is it possible to define types in Haskell which include as one of the fields an element which is a member of a certain class?
For example, say I want to define rational numbers as a tuple of two Nums, how would i do something along these lines:
type (Num a) => Q b = (a,a)
Currently that gives me an error but it seems as if something like this should be possible
For example, say I want to define rational numbers as a tuple of two Nums, how would i do something along these lines:
type (Num a) => Q b = (a,a)
Currently that gives me an error but it seems as if something like this should be possible