Fixing a type variable inside a function

Hal Daume III hdaume@ISI.EDU
Fri, 16 May 2003 08:03:21 -0700 (PDT)


Even so you're going to have a problem because your instances actually
evaluate the argument (cf. "toString Instance1 = "Instance1"").  If this
were "toString _ = "Instance1"", you'd be fine.

--
 Hal Daume III                                   | hdaume@isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume

On Fri, 16 May 2003, Karl-Filip Faxen wrote:

> Hi!
> 
> I think the following works:
> 
> foo = bar undefined
>   where bar :: MyTypeClass a => a -> a
>         bar x = fromString (toString x)
> 
> The type synonym is crucial in telling the compiler that the
> argument type (over which the occurrence of toSTring is overloaded)
> and the result type are the same.
> 
> Cheers,
> 
>     /kff
> 
> 
> _______________________________________________
> Haskell mailing list
> Haskell@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>