give equal rights to types and classes! :)

Bulat Ziganshin bulatz at HotPOP.com
Fri Feb 3 04:30:05 EST 2006


Hello Wolfgang,

Friday, February 03, 2006, 2:22:17 AM, you wrote:

>> 1) significantly simplifies declarations using typeclasses. i
>> was seriously bitten by those huge declarations, and think that
>> simplification in this area will lead to much wider use of type
>> classes by the ordibary users (like me :) .

WJ> "Simple" doesn't necessarily mean "small".  In my opinion, your smaller type 
WJ> declarations are confusing since they mix up classes and types.  Classes and 
WJ> types are two totally different things.  A class corresponds to a set of 
WJ> types, not to a single type, and a class has methods which a type has not.

type have the same methods, they are just not expressed directly. are
you know history of Array -> IArray change? functions "(!)",
"bounds" and so on in magic way round to class methods. if my idea was
incorporated in Haskell, this change don't require even changing
signatures of most functions working with arrays - just Array type
become Array interface, what a much difference?

Now i'm trying to generalize my functions parameters/results to type
classes instead of single types. for example, getFileSize function can
return any numeric value, be it Integer, Word or Int64. This,
naturally, results in those long and awkward signatures. Allowing to
write type of result as just "Integral" makes signature smaller
and more understandable for me:

getFileSize :: Stream Monad h -> Monad Integral


-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-prime mailing list