
27 Nov
2009
27 Nov
'09
9:36 a.m.
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,