storage_clone.bend

stelliferous@0.0.3.0 · 15 lines · 0 definitions

1import Base
2import stelliferous@0.0.3.0/storage_buffer.bend as Storage
3import stelliferous@0.0.3.0/proofs/storage_certificate.bend as Certificate
4import stelliferous@0.0.3.0/proofs/storage_clone_certificate.bend as CertificateClone
5
6def buffers(~Element: Data,+length: Nat,pair: Array<Element> & Array<Element>,certificates: CertificateClone.Copies<Element,pair>) -> Storage.Buffer<Element> & Storage.Buffer<Element>:
7  (left,right) = pair
8  CertificateClone.Copies{left_certificate,right_certificate} = certificates
9  (Storage.Buffer{left,length,left_certificate},Storage.Buffer{right,length,right_certificate})
10
11def clone(~Element: Data,input: Storage.Buffer<Element>) -> Storage.Buffer<Element> & Storage.Buffer<Element>:
12  Storage.Buffer{input,length,certificate} = input
13  Certificate.Certificate{+depth,+equation} = certificate
14  buffers(~Element,length,Array.clone(Element,input),CertificateClone.clone(~Element,input,
15    Certificate.Certificate{depth,equation},Certificate.Certificate{depth,equation},Certificate.Certificate{depth,equation}))