
8 Feb
2006
8 Feb
'06
10:16 a.m.
Marcin 'Qrczak' Kowalczyk wrote:
Bulat Ziganshin
writes: that i want to say is what the first variant allows to define type of 'x' in such way that the only Show-specific operations are allowed,
Why?
Parametricity, what else? I'd much rather pass my precious String to a function of type [a] -> [a] or Functor a => a Char -> a Char than to a function of type String -> String. Restricting an interface is a very good thing from a program verification standpoint. It's much the same in object-oriented languages, except that the existence of dynamic downcasting kind of spoils things. But then, Haskell has undefined and unsafePerformIO. -- Ben