
Hi Rahul,
Thanks for the explanation.
Hmm, Is not there much need...
Thank you code example.
I will also look at lexer for my study [1].
[1]: https://phabricator.haskell.org/D22
Thank you :) ,
Takenobu
2017-09-26 21:58 GMT+09:00 Rahul Muttineni
Implementation-wise, it's no so difficult to include - the lexer needs to be tweaked. But it seems like a specialised use-case that will only affect a minority of users is probably not worthwhile as an extension to the language/compiler.
Maybe you can try using OverloadedStrings and implement this as a library?
``` newtype Binary = Binary Integer deriving Num
instance IsString Binary where fromString binaryLiteral = error "Code here to parse binary literal with underscores"
binaryVal :: Binary binaryVal = "1101_1110_0101" ```
Hope that helps, Rahul
On Tue, Sep 26, 2017 at 8:40 AM, Takenobu Tani
wrote: Dear devs,
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)
[1]: https://inst.eecs.berkeley.edu/~cs150/fa06/Labs/verilog-ieee .pdf#page=20
Regards, Takenobu
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
-- Rahul Muttineni