[Haskell-cafe] Other instances of Integral

Sean Leather 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
function

  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
Integral.

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.
;)

Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091127/242cdc78/attachment.html


More information about the Haskell-Cafe mailing list