This should be relatively straightforward to implement: type permutationTest :: (v a -> v b -> Double) -> Int -> PValue, i.e. takes in a function that takes a vector of labels and a vector of samples to report a test statistic, a number of random runs, and returns the p-value (possibly with the observed test statistic of the samples with labels).