[Haskell-cafe] Fun with multi-parameter type classes

Henning Thielemann iakd0 at clusterf.urz.uni-halle.de
Fri Aug 20 08:48:19 EDT 2004


On Thu, 19 Aug 2004, Sam Mason wrote:

>    class Foo t where
>       encode :: String -> t
>       decode :: t -> String
> 
>    test = decode . encode
> 
> This currently fails, because the type checker insists on trying
> to figure out what its type should be - even though it shouldn't
> be needed.


In contrast to that,

 test = encode . decode

should not fail. :-)

Btw. for my association of the names 'encode' and 'decode' the signatures
are the other way round, i.e.

>       decode :: String -> t
>       encode :: t -> String




More information about the Haskell-Cafe mailing list