blob: 925a21ef395fc076509bb7b1534ff46a23893171 (
plain)
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
26
27
|
-- This should throw a warning
:set -XStaticPointers
:set -XScopedTypeVariables
:load StaticPtr.hs
import GHC.StaticPtr
import Prelude
:{
let checkKey :: forall a. (Show a, Eq a) => StaticPtr a -> IO ()
checkKey x = do
allKeys <- staticPtrKeys
Just x' <- unsafeLookupStaticPtr (staticKey x) :: IO (Maybe (StaticPtr a))
putStrLn $
show (deRefStaticPtr x)
++ " " ++
(if deRefStaticPtr x == deRefStaticPtr x'
then "good"
else "bad")
:}
checkKey s1
checkKey s2
-- :m + StaticPtr
--checkKey topLevelStatic
--checkKey (fst nestedStatic)
|