Henning Thielemann writes:

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. :-)

Rright. The source file:


bz = read . show

is accepted. It even "works":

Ok, modules loaded: Main.
*Main> :t bz
bz :: forall a a1. (Show a1, Read a) => a1 -> a


*Main> bz 8
8


But try to use it for something more exquisite:

*Main> bz 8.23
*** Exception: Prelude.read: no parse


Of course a signature put by hand helps. But then what's
the advantage of classes?


Actually, I would like to know what was the purpose of all
that...


Jerzy Karczmarczuk
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to