Skip to content

Instantly share code, notes, and snippets.

View sarthakbagaria's full-sized avatar

Sarthak Bagaria sarthakbagaria

View GitHub Profile
sarthakbagaria / utxo-blockchain.hs
Created July 28, 2018 18:27
A simple UTxO based blockchain ledger implementation with formally verified invariants.
#!/usr/bin/env stack
-- stack --resolver lts-11.6 script --package containers
module Blockchain where
import Data.Set (Set)
import qualified Data.Set as Set
-- refining just to get measures from data constructors
{-@ data Tx = Tx { tI :: Set Inp, tO :: [Out] } @-}
sarthakbagaria / distributed-computing.hs
Created July 22, 2018 19:36
A script to demonstrate distributed computing using Cloud Haskell. Each node sends a randomly generated number to every node (including itself), and at the end each node aggregates all the messages it received. Install Haskell 'stack' before running this script. First spin up some slave (messaging) nodes using 'distributed-computing.hs --host-ra…
#!/usr/bin/env stack
{- stack
--resolver lts-11.17
--package distributed-process
--package network-transport-tcp
--package distributed-process-simplelocalnet
--package pqueue
--package options
--package random