summaryrefslogtreecommitdiff
path: root/backends/lean/Base/Primitives/Alloc.lean
blob: 6c89c6bb3fa4e82403aef72d1b1474ae50ea1b89 (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
28
29
30
31
32
33
34
35
36
37
import Lean
import Base.Primitives.Base
import Base.Primitives.CoreOps

open Primitives
open Result

namespace alloc

namespace boxed -- alloc.boxed

namespace Box -- alloc.boxed.Box

def deref (T : Type) (x : T) : Result T := ret x
def deref_mut (T : Type) (x : T) : Result T := ret x
def deref_mut_back (T : Type) (_ : T) (x : T) : Result T := ret x

/-- Trait instance -/
def coreopsDerefInst (Self : Type) :
  core.ops.deref.Deref Self := {
  Target := Self
  deref := deref Self
}

/-- Trait instance -/
def coreopsDerefMutInst (Self : Type) :
  core.ops.deref.DerefMut Self := {
  derefInst := coreopsDerefInst Self
  deref_mut := deref_mut Self
  deref_mut_back := deref_mut_back Self
}

end Box -- alloc.boxed.Box

end boxed -- alloc.boxed

end alloc