Kevin Atkinson wrote:

> ... However, there should be some way to get the return type with out having to 
>explicitly store it in the object as a bulk type.

Another solution I thought of is to be able to have auxiliary types in
class
such as

class Listable c, a where
  toList :: c -> [a]  

instance Listable [a], a where
  toList a = a

which is saying only try to resolve an overload using _c_.  Once the
overload is resolved _a_ automatically has a type based on the instance
declaration.  For example:
  toList [10,20,30}
would resolve just find because c is [Int].  a will automatically have
the type Int because that is what the instance declaration says.  If the
type Int is incompatible with with what the return type needs to be then
there is a type error.

-- 
Kevin Atkinson
[EMAIL PROTECTED]
http://metalab.unc.edu/kevina/


Reply via email to