Skip to content

Instantly share code, notes, and snippets.

Avatar

Sarthak Bagaria sarthakbagaria

View GitHub Profile
@sarthakbagaria
sarthakbagaria / utxo-blockchain.hs
Created Jul 28, 2018
A simple UTxO based blockchain ledger implementation with formally verified invariants.
View utxo-blockchain.hs
#!/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
sarthakbagaria / distributed-computing.hs
Created Jul 22, 2018
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…
View distributed-computing.hs
#!/usr/bin/env stack
{- stack
script
--resolver lts-11.17
--package distributed-process
--package network-transport-tcp
--package distributed-process-simplelocalnet
--package pqueue
--package options
--package random