Skip to content

Instantly share code, notes, and snippets.

@stelleg
stelleg / withConstArray.hs
Created July 29, 2018 15:56
alpha-equivalence example
import Foreign.Ptr
import Foreign.Storable
import Foreign.Marshal.Array
{-@ type PtrLen a n = {v:Ptr a | plen v = n && 0 <= pbase v && 0 <= plen v} @-}
{-@ withArray :: Storable a => x:[a] -> (PtrLen a (len x) -> IO b) -> IO b @-}
{-@ withConstArray :: Storable a => a -> n:Nat -> (PtrLen a n -> IO b) -> IO b @-}
withConstArray x n = withArray (replicate n x)
@stelleg
stelleg / Dockerfile
Created October 17, 2018 04:37
centos tapir Dockerfile
FROM centos
ADD tapir.tgz /usr/
ADD hello /tapir/hello
RUN yum update -y && yum install -y libcilkrts libedit gcc make
RUN ln -s /usr/lib64/libcilkrts.so.5 /usr/lib/libcilkrts.so
CMD [ "/bin/bash" ]
#include<optional>
#include<vector>
#include<iostream>
using namespace std;
enum opCode {
start, // start loc
send, // send instrResult loc
mix // mix instrResult instrResult
};