classes and instances

2001-10-04 Thread Russo, Tom
Hello, I'm learning haskell and I'm having some trouble with type classes. I understand them conceptually, but when I try to create an instance I run into problems. As a simple example, I create a class called ToInt: > class ToCh a where > int :: a -> Int Then I create an

Re: classes and instances

2001-10-04 Thread Ashley Yakeley
At 2001-10-04 08:31, Russo, Tom wrote: >Main> int 5 >ERROR - Unresolved overloading >*** Type : (Num a, ToInt a) => Int >*** Expression : int 5 > >Can someone explain what the problem is, and how to interpret the error >message I'm getting? Oh, 5 isn't necessarily an Int. It's of type "Num