1f619a75696455ff19a3d6aa18a941dc36258d2d
[ghc.git] / testsuite / tests / th / TH_StaticPointers02.hs
1 {-# LANGUAGE TemplateHaskell #-}
2 {-# LANGUAGE StaticPointers #-}
3
4 -- | A test to try the static form in splices.
5 --
6 -- A static form is defined in a splice and then it is used in the program.
7 --
8 module Main(main) where
9
10 import GHC.Fingerprint
11 import GHC.StaticPtr
12
13 main = print $ $(case staticKey (static 'a') of
14 Fingerprint w0 w1 ->
15 let w0i = fromIntegral w0 :: Integer
16 w1i = fromIntegral w1 :: Integer
17 in
18 [| fmap (\p -> deRefStaticPtr p :: Char) $ unsafeLookupStaticPtr $
19 Fingerprint (fromIntegral w0i) (fromIntegral w1i)
20 |]
21 )