purescript-contrib / purescript-bigints

Arbitrary length integers for PureScript
MIT License
26 stars 22 forks source link

toBase #4

Closed Unisay closed 7 years ago

Unisay commented 7 years ago

At the moment, its possible to parse a string representation of a base-n encoded number using fromBase :: Int -> String -> BigInt

However, its not currently possible to go other way around, from BigInt to its base-n representation (only decimal base is supported via toString)

So, having a method toBase :: Int -> BigInt -> String would be quite useful and make things isomorphic.

sharkdp commented 7 years ago

Sounds good!

Looks like this is supported by the underlying JavaScript module: https://github.com/peterolson/BigInteger.js#tostringradix--10

Unisay commented 7 years ago

https://github.com/sharkdp/purescript-bigints/pulls