It is not clear what you are asking:
Does this function work like this?
showIntAtBase 6 1025554775 = 245433110435
- No. The function defined in Numeric does not work by pattern matching all possible numbers and providing a literal result.
- No. The code you typed is not type correct. You haven't even provided the correct number of arguments.
Notice the type for showIntAtBase:
> :t showIntAtBase
showIntAtBase
:: (Show a, Integral a) => a -> (Int -> Char) -> a -> ShowS
Expanding for the ShowS
type alias we get:
> :t showIntAtBase
showIntAtBase
:: (Show a, Integral a) => a -> (Int -> Char) -> a -> String -> String
So you need to provide four arguments, not two numbers. For example, you can use Data.Char.intToDigit
to convert integers to characters and you can use the empty string for the suffix string:
> import Data.Char (intToDigit)
> import Numeric (showIntAtBase)
> showIntAtBase 6 intToDigit 1025554775 ""
"245433110435"