give equal rights to types and classes! :)

Bulat Ziganshin bulatz at
Sat Feb 4 05:56:54 EST 2006

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,
 Bulat                            mailto:bulatz at

More information about the Haskell-prime mailing list