Search code examples
haskellbinaryhexghci

Binary numbers with Haskell


I know it is possible with Haskell to pass values in octal with 0o777 and Hexadecimal with 0x1FF but:

Is it possible to pass a value in binary with Haskell?


Solution

  • Yes, with the {-# LANGUAGE BinaryLiterals #-} extension, as 0b01101. See here for some more details.