This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |