
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