blob: 24f0ec7811ce7c461f64f2af58a010a3b047d101 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
{-# LANGUAGE MagicHash #-}
module Main (f, main) where
import GHC.Exts(Ptr(..))
import Foreign.Ptr
-- We should be able to inline this function.
f :: Ptr Int -> Int -> Int
f =
let x = "foo"#
in \p n -> n + (Ptr x `minusPtr` p)
main :: IO ()
main = print $ x `mod` 2 == (x + 4) `mod` 2
where
x = go (10000::Int) 4
go 0 a = a
go n a = go (n-1) (f nullPtr a)
|