Overloading in gofer 
Author Message
 Overloading in gofer

I have a problem with overloading in gofer, which I hope someone might
be able to help me with. I wish to define a type class C, with a
predicate f, whose default value is false. I then wish to include the
data type of sets in this class. My script looks like:

class C a where
  f:: a -> Bool
  f x = False

data Set a = Set [a]

instance C (Set a)

This works ok e.g.

? f (Set [1])
(2 reductions, 13 cells)
? f (Set ["hello", "world"])
(2 reductions, 17 cells)

However, it doesn't work if I apply f to the empty set:

? f (Set [])
ERROR: Unresolved overloading
*** type        : C (Set a) => Bool
*** translation : f (Set [])

I appreciate that I can fix this by explicitly stating the type of the
set, but for my application this won't always be possible.

Hence, can anyone suggest a way round this problem of empty sets,
other than explicit typing?




School of Computer Studies      |   tel: 0113 233 5193
University of Leeds             |   fax: 0113 233 5468
Leeds LS2 9JT.                  |

Tue, 01 Dec 1998 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Overloading function application in Gofer

2. Re : overloading in Haskell/Gofer

3. Numericall Software in Gofer/Haskell/SML

4. Upperbound for typevariables in PC-gofer 2.28?

5. translating gofer into lambda expressions

6. newbie need help on gofer

7. Fokker's jpeg gofer code to haskell?

8. Anyone Familiar with Gofer ?

9. Trying to run Gofer in DOS on 486 PC

10. Looking for Gofer PC executable

11. Gofer-Java interface ?

12. Running a gofer program from Java?


Powered by phpBB® Forum Software