Fixing a type variable inside a function

Karl-Filip Faxen kff@it.kth.se
Fri, 16 May 2003 16:58:23 +0200


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