blob: 1d8db97387daba2c23231681cbda89ea8a533269 (
plain) (
blame)
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
28
29
30
31
32
33
34
35
36
|
definition module unsafe_heap
import StdClass
:: Heap v = {heap::!.HeapN v}
:: HeapN v
:: Ptr v = {pointer::!.(PtrN v)};
:: PtrN v = Ptr !v;
newHeap :: .Heap v
nilPtr :: Ptr v
isNilPtr :: !(Ptr v) -> Bool
newPtr :: !v !*(Heap v) -> (!.Ptr v,!.Heap v)
readPtr :: !(Ptr v) !u:(Heap v) -> (!v,!u:Heap v)
writePtr :: !(Ptr v) !v !*(Heap v) -> .Heap v
sreadPtr :: !(Ptr v) !(Heap v) -> v
allocPtr :: Ptr v;
initPtr :: !(Ptr v) !v !*(Heap v) !*World -> (!.Heap v,!*World);
ptrToInt :: !(Ptr w) -> Int
(<:=) infixl
(<:=) heap ptr_and_val :== writePtr ptr val heap
where
(ptr, val) = ptr_and_val
instance == (Ptr a)
|