Safety
garyb opened this issue · comments
Gary Burgess commented
Not to rain on your parade, but the reason these don't exist in the core libraries is they're actually a bit tricky to get right. ;)
We did have them at one point, and then later removed them because they only work with certain arguments, and we didn't want to wrap them in an Eff
with an exception or something.
The rules according to MDN:
toExponential
andtoFixed
throw aRangeError
if thedigits
provided is not between 0 and 20toPrecision
throws aRangeError
if theprecision
provided is not between 0 and 100toString
throws aRangeError
if theradix
provided is not between 2 and 36
Jonathan Childress commented
Thanks for the feedback! I've made duplicates that wrap the results in either a Maybe
or Eff
. Are there any changes that should be made (namespacing or otherwise) so this matches other PureScript modules?
Jonathan Childress commented
Handled better in PR #4.