summaryrefslogtreecommitdiff
path: root/libraries/base/tests/stableptr005.hs
blob: dc4928ab6c6bc0e3db4e642bb7d1f4508b195ae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- !!! triggered a temporary bug in freeStablePtr around 20020424

module Main where
import Foreign.StablePtr (newStablePtr, freeStablePtr)

data Foo = A | B | C | D

main :: IO ()
main = do aSPtr <- newStablePtr A
          bSPtr <- newStablePtr B
          cSPtr <- newStablePtr C
          cSPtr' <- newStablePtr C
          freeStablePtr aSPtr
          freeStablePtr bSPtr
          freeStablePtr cSPtr
          freeStablePtr cSPtr'
          aSPtr <- newStablePtr A
          bSPtr <- newStablePtr B
          cSPtr <- newStablePtr C
          dSPtr <- newStablePtr D
          print "Hello World"