Skip to content

Instantly share code, notes, and snippets.


Mads Buch madsbuch

View GitHub Profile
madsbuch / jsonl-parse-perf-test.js
Created Jul 23, 2021
Performance test on 2 different parsing strategies for JSON lines files.
View jsonl-parse-perf-test.js
* This is a small informal performance test to see how it best makes sense to
* read JSON-lines files. The JSONL format is a file with a JSON object on each
* line. This is opposed to a JSON file with an array on the top level
* containing each object.
* I test two evaluation strategies:
* 1. Split the string on new lines and parse each string individually
* 2. Massage the string into a stringifies JSON array and parse it
View ProbMonad.hs
The following code is based on experimental code by Aslan Askerov
based on Ramsey and Pfeffers "Stochastic Lambda Calculus and Monads of
Probability Distributions". Implementation of random n is from
Audebaud and Paulin-Mohring paper, so is the random walk example.
This gist is used here
The class hierarchy is as follows:
View Proof.hs
{-# LANGUAGE GADTs #-} -- Soft dependent types
{-# LANGUAGE PolyKinds #-} -- Allow general specification of Refl
{-# LANGUAGE RankNTypes #-} -- Explicit quantification and inline type context
{-# LANGUAGE DataKinds #-} -- Lift data constructors to Kind level
{-# LANGUAGE TypeFamilies #-} -- Equational reasoning about types
{-# LANGUAGE TypeOperators #-} -- Allow types such as :~:
-- Starting the interactive shell:
-- ghci -XDataKinds -XTypeOperators -Wall -Werror Script.hs