Re[2]: give equal rights to types and classes! :)
Hello Marcin, Saturday, February 04, 2006, 2:23:50 AM, you wrote: 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? What would 'Eq - Eq - Ord - Bool' mean? MQK '(Eq a, Eq b, Ord c) = a - b - c - Bool'? MQK '(Eq a, Ord b) = a - a - b - Bool'? MQK '(Eq a, Ord a) = a - a - a - Bool'? as i stated in the post, the one class name instantiates one variable. so the proper variant will be second i know that this syntax can't substitute ALL possible uses of preconsitions, it's just for most common, in my sense. moreover, it will help to convert currently used types to classes, and to easily refactor user programs back and forth between using types and classes -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
Re[3]: give equal rights to types and classes! :)
Hello Dave, Saturday, February 04, 2006, 3:52:46 AM, you wrote: 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 DM How does that type translate back into current Haskell? Assuming DM Stream is a type, and not a class, I see at least three possibilities: DM (Integral a, Monad m) = Stream m h - m a DM (Integral a, Monad m1, Monad m2) = Stream m1 h - m2 a DM (Integral a, Monad m) = (forall m. Monad m = Stream m h) - m a first and i said that in my post. the translation includes only moving classes to the left side of = and types to the right side of =, and using one type variable per each class name. btw, Stream is a class in my lib, so the right translation is: (Integral int, Monad m, Stream m h) = h - m int -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
Re[2]: give equal rights to types and classes! :)
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, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
Re: give equal rights to types and classes! :)
Bulat Ziganshin [EMAIL PROTECTED] writes: 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? What would 'Eq - Eq - Ord - Bool' mean? '(Eq a, Eq b, Ord c) = a - b - c - Bool'? '(Eq a, Ord b) = a - a - b - Bool'? '(Eq a, Ord a) = a - a - a - Bool'? -- __( Marcin Kowalczyk \__/ [EMAIL PROTECTED] ^^ http://qrnik.knm.org.pl/~qrczak/ ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
Re[2]: give equal rights to types and classes! :)
Bulat Ziganshin writes: 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 How does that type translate back into current Haskell? Assuming Stream is a type, and not a class, I see at least three possibilities: (Integral a, Monad m) = Stream m h - m a (Integral a, Monad m1, Monad m2) = Stream m1 h - m2 a (Integral a, Monad m) = (forall m. Monad m = Stream m h) - m a -- David Menendez [EMAIL PROTECTED] | In this house, we obey the laws http://www.eyrie.org/~zednenem |of thermodynamics! ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
Re[2]: give equal rights to types and classes! :)
On Wed, 1 Feb 2006, Bulat Ziganshin wrote: btw, on the http://haskell.galois.com/trac/haskell-prime/wiki/PartialTypeSigs author mean using underscore for (exists a . a) types No I don't, for a number of technical reasons. -- [EMAIL PROTECTED] There is no magic bullet. There are, however, plenty of bullets that magically home in on feet when not used in exactly the right circumstances. ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime