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