r/purescript • • Feb 04 '16

purescript-colors

http://sharkdp.github.io/purescript-colors/
7 Upvotes

17 comments sorted by

View all comments

Show parent comment

1

u/sharkdp Feb 09 '16

Thanks for the reference. Shouldn't this return an Int?

I've implemented this by using the FFI in the meantime (https://github.com/sharkdp/purescript-colors/blob/master/src/Color.js). Is there any way I could write toHex with existing library functions? That is, do we have Number.prototype.toString somewhere?

1

u/hdgarrood Feb 09 '16

The reason it doesn't return an Int is that you might want an integral value outside the 32 bit range. Come to think of it we should probably add a version that does return Int to purescript-integers.

Number.toString might just be the Show Number instance. Not sure.

1

u/hdgarrood Feb 09 '16

Ohh sorry, I didn't realise you wanted to specify the radix. I'm not aware of any library that has that, but we should definitely have it in core somewhere, IMO.