blob: 5f77b580ba83f9f88b9465059ad5a6123648232e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
{-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns #-}
module Main where
import GHC.Exts
{-# NOINLINE foo1 #-} -- Make it harder to get right
foo1 x = (# x,x #)
{-# NOINLINE foo2 #-} -- Make it harder to get right
foo2 x = (# x, (# True, False #) #)
{-# NOINLINE foo3 #-} -- Make it harder to get right
foo3 (# x,y #) = x
main = print $ foo3 (# if b then x + y else x - y, 30 #)
where (# x, _ #) = foo1 10
(# y, (# b, _ #) #) = foo2 20
|