IdrisDoc: Effect.Memory

# Effect.Memory

poke : (offset : Nat) -> Vect size Bits8 -> So (offset <= i && Delay (offset + size <= n)) -> Eff () [ RAW_MEMORY (MemoryChunk n i)] (\v => [ RAW_MEMORY (MemoryChunk n (max i (offset + size)))])
peek : (offset : Nat) -> (size : Nat) -> So (offset + size <= i) -> Eff (Vect size Bits8) [ RAW_MEMORY (MemoryChunk n i)] (\result => [ RAW_MEMORY (MemoryChunk n i)])
move : (dst_offset : Nat) -> (src_offset : Nat) -> (size : Nat) -> So (dst_offset <= dst_init && Delay (dst_offset + size <= dst_size)) -> So (src_offset + size <= src_init) -> Eff () [ Dst ::: RAW_MEMORY (MemoryChunk dst_size dst_init), Src ::: RAW_MEMORY (MemoryChunk src_size src_init)] (\v => [ Dst ::: RAW_MEMORY (MemoryChunk dst_size (max dst_init (dst_offset + size))), Src ::: RAW_MEMORY (MemoryChunk src_size src_init)])
initialize : Bits8 -> (size : Nat) -> So (i + size <= n) -> Eff () [ RAW_MEMORY (MemoryChunk n i)] (\v => [ RAW_MEMORY (MemoryChunk n (i + size))])
free : Eff () [ RAW_MEMORY (MemoryChunk n i)] (\v => [ RAW_MEMORY ()])
allocate : (n : Nat) -> Eff () [ RAW_MEMORY ()] (\v => [ RAW_MEMORY (MemoryChunk n (fromInteger 0))])
data RawMemory : Effect
  Allocate : (n : Nat) -> RawMemory () () (\v => MemoryChunk n (fromInteger 0))
  Free : RawMemory () (MemoryChunk n i) (\v => ())
  Initialize : Bits8 -> (size : Nat) -> So (i + size <= n) -> RawMemory () (MemoryChunk n i) (\v => MemoryChunk n (i + size))
  Peek : (offset : Nat) -> (size : Nat) -> So (offset + size <= i) -> RawMemory (Vect size Bits8) (MemoryChunk n i) (\v => MemoryChunk n i)
  Poke : (offset : Nat) -> Vect size Bits8 -> So (offset <= i && Delay (offset + size <= n)) -> RawMemory () (MemoryChunk n i) (\v => MemoryChunk n (max i (offset + size)))
  Move : (src : MemoryChunk src_size src_init) -> (dst_offset : Nat) -> (src_offset : Nat) -> (size : Nat) -> So (dst_offset <= dst_init && Delay (dst_offset + size <= dst_size)) -> So (src_offset + size <= src_init) -> RawMemory () (MemoryChunk dst_size dst_init) (\v => MemoryChunk dst_size (max dst_init (dst_offset + size)))
  GetRawPtr : RawMemory (MemoryChunk n i) (MemoryChunk n i) (\v => MemoryChunk n i)
RAW_MEMORY : Type -> EFFECT
data MoveDescriptor : Type
  Dst : MoveDescriptor
  Src : MoveDescriptor
data MemoryChunk : Nat -> Nat -> Type
  CH : Ptr -> MemoryChunk size initialized