Add -XBinaryLiterals language extension (re #9224)
[ghc.git] / testsuite / tests / parser / should_run / BinaryLiterals1.hs
1 -- | Test for GHC 7.10+'s @BinaryLiterals@ extensions (see GHC #9224)
2
3 {-# LANGUAGE BinaryLiterals #-}
4 {-# LANGUAGE MagicHash #-}
5
6 module Main where
7
8 import GHC.Types
9
10 main = do
11 print [ I# 0b0#, I# -0b0#, I# 0b1#, I# -0b1#
12 , I# 0b00000000000000000000000000000000000000000000000000000000000000000000000000001#
13 , I# -0b00000000000000000000000000000000000000000000000000000000000000000000000000001#
14 , I# -0b11001001#, I# -0b11001001#
15 , I# -0b11111111#, I# -0b11111111#
16 ]
17 print [ W# 0b0##, W# 0b1##, W# 0b11001001##, W# 0b11##, W# 0b11111111##
18 , W# 0b00000000000000000000000000000000000000000000000000000000000000000000000000001##
19 ]
20
21 print [ 0b0, 0b1, 0b10, 0b11, 0b100, 0b101, 0b110, 0b111 :: Integer
22 , -0b0, -0b1, -0b10, -0b11, -0b100, -0b101, -0b110, -0b111
23 , 0b11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
24 , -0b11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
25 ]