Underscore in binary literals

Niklas Hamb├╝chen mail at nh2.me
Tue Sep 26 13:43:48 UTC 2017


I'd find that quite useful for hex and binary.

It's useful for distinguishing e.g. 0xffffffff and 0xfffffff which when
confused accidentally and lead to big bugs.

Rust has exactly this feature for all numeric literals:

  https://rustbyexample.com/primitives/literals.html

On 26/09/17 14:40, Takenobu Tani wrote:
> GHC's BinaryLiterals extension is useful.
> (For example, x = 0b110111000101)
> 
> Is it difficult to include underscore(_) in the format like Verilog-HDL[1] ?
> (For example, x = 0b1101_1100_0101)


More information about the ghc-devs mailing list