Natural ASCII Builders
- Dominant language
- Haskell
- Stars
- 301
- Forks
- 144
- Avg merge
- 7d 22h
- Merged PRs (30d)
- 1
Description
Currently the bytestring library has an `integerDec` function, but no corresponding `integerHex` function.
```haskell
integerDec :: Integer -> Builder -- currently exists
integerHex :: Integer -> Builder -- doesn't (probably shouldn't) exist
```
I think this makes sense. I presume the idea is that hex representations of unbounded signed integers don't make much sense. It would be unclear how to represent the negatives, since it isn't traditional to express hexadecimal numbers using a negation sign (`'-'`) and two's complement requires a fixed size. Unfortunately, this presently leaves us without *any* means of hex-encoding unbounded numbers.
However, it seems to me that we *could* include support for unbounded *unsigned* integers -- the `Natural` type.
```haskell
naturalHex :: Natural -> Builder -- doesn't (should) exist
```
And (by the way) I think it would also make sense to include the decimal variant as well.
```haskell
naturalDec :: Natural -> Builder -- doesn't (should) exist
```
`Natural` appeared in `base-4.8` and `bytestring` supports all the way back to `base-4.3`, so I think these would have to be conditionally included `#if __GLASGOW_HASKELL__ >= 7101`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.