On Thu, 24 Oct 1996, Benedict R. Gaster wrote:
| > class Sequence a s where
| > cons :: a -> s -> s
| > nth :: s -> Int -> a
| > len :: s -> Int
|
| > instance Sequence a (List a) where
| > cons = (:)
| > nth = (!)
| > len = (#)
|
| Feeding this example into the Gofer type system produces the following error
| message:
|
| ERROR "tmp.lhs" (line 4): Ambiguous type signature in class declaration
| *** ambiguous type : Sequence a b => b -> Int
| *** assigned to : len
Doesn't Haskell do the same if you say:
class Cow a where
pig :: a -> Int
fly :: Int
In this case fly is also too general. I am not sure, since I haven't got a
Haskell implementation here.
Koen.
--
| Koen Claessen, [EMAIL PROTECTED] |
| http://www.cse.ogi.edu/~kcclaess/ |
|------------------------------------------------------|
| Visiting student at OGI, Portland, Oregon, USA. |