I wrote the following function that attempts to generalize show by
allowing the user to choose the function to stringify constructor
arguments.

> stringArgs' sep stringer1 (MyFoo x i s) = 
>        x' ++sep++i' ++ sep ++ s'
>      where 
>       x'=stringer' x
>       i'=stringer'' i
>       s'=stringer''' s
>       stringer' o=stringer o
>       stringer'' o=stringer o
>       stringer''' o =stringer o
>       stringer o=stringer1 o --!! replacing stringer1 w/ show works!

This function generates a type error because stringer is being used as
Int->Char and as Char->Char.  But, if I replace stringer1 in the last
line, with the function `show`, hugs allows this function.

However, if I use show and attempt to call this function using foo:

> foo x = stringArgs "\n" show (MyFoo "asd" 12 "asd")

I get an ambiguous type signature error.

What am I doing wrong?

-Alex-

___________________________________________________________________
S. Alexander Jacobson                   i2x Media  
1-212-697-0184 voice                    1-212-697-1427 fax


Reply via email to