<div dir="ltr">Hi,<div><br></div><div><div>The current implementation of showIntAtBase in Numeric is limited to Chars currently.<br></div><div><br></div><div><div><i>showIntAtBase</i></div><div><i>  :: (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS</i></div></div><div><br></div><div>The 2 reasons for this constraint is:</div><div>    a) We only accept functions of the form (Int -> Char)  </div><div>    b) An implicit concatenation using  (:)</div><div><br></div><div>I'd like to propose a new function showIntAtBaseGeneric that removes the (Int -> Char) function constraint and takes an additional function to replace the implicit (:) operator.</div><div><br></div><div><div><i>showIntAtBaseGeneric</i></div><div><i>  :: (Integral a1, Num b, Show a1) =></i></div><div><i>     a1 -> (b -> a) -> (a -> s -> s) -> a1 -> s -> s</i></div></div><div><br></div><div>Now showIntAtBase may be implemented as:</div><div><br></div><div><div><i>showIntAtBase :: (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS</i></div><div><i>showIntAtBase base toChr n0 r0 = showIntAtBaseGeneric base toChr (:) n0 r0</i></div></div><div><br></div><div>The API and behavior of showIntAtBase remains unchanged while allowing for generic conversions not limited to Chars alone.</div><div><br></div><div><i>Example: </i></div><div><i>λ>  showIntAtBaseGeneric 26 id (:) 500 [] -- convert 500 to base26 and provide output as a list.</i></div><div><i>[19,6]</i></div><div><br></div><div>Please let me know thoughts/concerns if any to this proposal.</div><div><br></div><div>Cheers,</div><div>Vikas</div></div></div>