Is there a platform function that will do the following?
convertBase :: (Num a, Num b) => Int -> Int -> [a] -> [b]
Convert a number from base ‘a’ to base ‘b’ where each list item is a digit in the number.
for example:
convertBase 2 10 [1,1,0,1] = [1, 3]
I hope that makes sense, let me know if i can clear anything up
Using the digits package from Hackage:
You can add a
fromIntegralin there if you need the input and output types to be different. Also, theIntegralconstraint makes more sense thanNum, since you probably don’t want to deal with complex or floating-point digits.