Skip to content

Instantly share code, notes, and snippets.

View madsbuch's full-sized avatar

Mads Buch madsbuch

View GitHub Profile
@madsbuch
madsbuch / jsonl-parse-perf-test.js
Created July 23, 2021 08:56
Performance test on 2 different parsing strategies for JSON lines files.
/**
* 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
{-# LANGUAGE GADTs #-}
{-
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 http://madsbuch.com/the-probability-monad/
The class hierarchy is as follows:
@madsbuch
madsbuch / Proof.hs
Last active January 12, 2023 18:31
{-# 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