give equal rights to types and classes! :)

Dave Menendez dave at zednenem.com
Fri Feb 3 19:52:46 EST 2006


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 <zednenem at psualum.com> | "In this house, we obey the laws
<http://www.eyrie.org/~zednenem>      |        of thermodynamics!"


More information about the Haskell-prime mailing list