Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I enable BinaryLiterals?

Tags:

haskell

ghc

There's a BinaryLiterals extension mentioned in the Language.Haskell.Extensions document. The idea is you can say 0b11 == 3.

> :set -XBinaryLiterals
Some flags have not been recognized: -XBinaryLiterals
like image 595
Michael Fox Avatar asked Nov 05 '14 18:11

Michael Fox


People also ask

How do you write binary literals?

Binary literals can be written in one of the following formats: b'value' , B'value' or 0bvalue , where value is a string composed by 0 and 1 digits. Binary literals are interpreted as binary strings, and are convenient to represent VARBINARY, BINARY or BIT values.

What is a binary literal?

A binary literal is a number that is represented in 0s and 1s (binary digits). Java allows you to express integral types (byte, short, int, and long) in a binary number system. To specify a binary literal, add the prefix 0b or 0B to the integral value.

Does C support binary literal?

Binary integer literals (0b…) are supported in the C++ language but not in the C language.

What is binary literal in Python?

Binary literals begin with a leading 0b or 0B, followed by binary digits (0-1). All of these literals produce integer objects in program code; they are just alternative syntax for specifying values. The built-in calls hex(I), oct(I), and bin(I) convert an integer to its representation string.


1 Answers

According to this https://ghc.haskell.org/trac/ghc/ticket/9224, it is slated for release in version 7.10.1. This doesn't seem to be released yet.

like image 70
jamshidh Avatar answered Sep 29 '22 09:09

jamshidh