[Haskell-cafe] Other instances of Integral
leather at cs.uu.nl
Fri Nov 27 09:36:53 EST 2009
> I have not understood what the question is. Are you asking "Why would
> one need functions of the form (Integral a) => ...a... if one can just
> use ...Integer... or ...Int... explicitly"?
To clarify, the problem Tsun is asking about is Ex. 9 (bonus) in
http://www.cs.uu.nl/wiki/FP/Practicum#PracticumOne . Define the following
toDigitsRevG :: (Integral a) => a -> a -> [a]
that takes a base and a value and outputs the reverse list of digits. The
function must be total (modulo bottom) and thus work for any instance of
This is a first-year course, so I expect this to be a difficult problem for
those seeing Haskell for the first time. That's why it's a bonus exercise.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe