Overloading function application in Gofer 
Author Message
 Overloading function application in Gofer

Hi!

I want to overload function application in Gofer.

I have defined the following class:

Quote:

> class Apply fun arg res where


Then I define instances:

        ordinary function application:

Quote:
> instance Apply (a -> b) a b where

>            f x

        representing a function by its map using a
        list of argument-result pairs:

Quote:
> instance (Eq a) => Apply [(a,b)] a b where

>            head [f_arg | (arg,f_arg) <- f , arg == x ]

Unfortunately, if I evaluate this:


then I get the following error:

ERROR: Unresolved overloading
*** type        : Apply (Int -> Char) Int a => a

Sure, I could throw in some type-annotations, but I'd rather avoid them.

Does anyone know how to do this neatly?

(BTW, I do have a useful application (pun not intended 8^) for this.)

(BTW^2, I'll do the functional I/O summary real soon now, too.)

Cheers,

        Bert.

-----------------------------------------------------------------------

department of computer science                  university of melbourne
-----------------------------------------------------------------------
                        g e t  t h e  p o i n t
-----------------------------------------------------------------------



Fri, 23 Feb 1996 19:26:23 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Overloading in gofer

2. Re : overloading in Haskell/Gofer

3. gofer functions 'n stuff

4. Gofer "atom" function

5. transcendental functions in Gofer

6. Operator overloading applications needed

7. C4:Function Overloading

8. Function Overloading

9. function overloading

10. Range (was: overloading in function)

11. overloading in function

12. Overloading one instance of a dispatching function

 

 
Powered by phpBB® Forum Software