Skip to content

Instantly share code, notes, and snippets.

@EncodePanda
EncodePanda / TwoThreeTree.hs
Last active November 21, 2021 21:51
First attempt to implement 2-3 tree as outlined in the "Finger Trees: A Simple General-purpose Data Structure" paper
-- λ> fromList [1]
-- Zero 1
-- λ> fromList [1..2]
-- Succ (Zero (Node2 1 2))
-- λ> fromList [1..4]
-- Succ (Succ (Zero (Node2 (Node2 1 2) (Node2 3 4))))
-- λ> fromList [1..8]
@EncodePanda
EncodePanda / functionaldeps.md
Last active September 7, 2020 16:29
Functional Dependencies dilemma

hi all, I'm trying to get my head around functional dependencies I've created a simplified version of MonadReader that has no functional dependencies

class MyMonadReader r m where
  ask :: m r

What works as expected

When creating instances like

Pawel Szulc
Table of Contents
_________________
1 Install Nix
2 Install Brew :(
3 Zsh and Oh my zsh
.. 3.1 Install zsh and zsh-completions

Since macOS Catalina, the root drive is read-only. The solution is to create a separate APFS volume and a “synthetic” /nix directory which points to it:

# Check if /nix exists, if not:
echo 'nix' | sudo tee -a /etc/synthetic.conf
# this will create a "synthetic" empty directory /nix

# REBOOT so macOS sees the synthetic directory

# After rebooting, create an APFS volume for Nix
nix-shell --pure --show-trace
building '/nix/store/dkmy7cp9dqb2xqnjx1x3lgarn5y2kv07-all-cabal-hashes-component-stylish-haskell-0.9.2.2.drv'...
tar: */stylish-haskell/0.9.2.2/stylish-haskell.json: Not found in archive
tar: */stylish-haskell/0.9.2.2/stylish-haskell.cabal: Not found in archive
tar: Exiting with failure status due to previous errors
builder for '/nix/store/dkmy7cp9dqb2xqnjx1x3lgarn5y2kv07-all-cabal-hashes-component-stylish-haskell-0.9.2.2.drv' failed with exit code 2
cannot build derivation '/nix/store/d9281ziwi2rkfrk40w1y55krxym43p93-cabal2nix-stylish-haskell-0.9.2.2.drv': 1 dependencies couldn't be built
error: while evaluating the attribute 'buildInputs' of the derivation 'ghc-shell-for-packages' at /nix/store/zrz1pihi0blg5mzchv19agqkjxd2vlag-nixos-release-19.03/pkgs/development/haskell-modules/make-package-set.nix:301:9:
while evaluating 'getOutput' at /nix/store/zrz1pihi0blg5mzchv19agqkjxd2vlag-nixos-release-19.03/lib/attrsets.nix:464:23, called from undefined position:
while evaluating anon
# stylish-haskell configuration file
# ==================================
# The stylish-haskell tool is mainly configured by specifying steps. These steps
# are a list, so they have an order, and one specific step may appear more than
# once (if needed). Each file is processed by these steps in the given order.
steps:
# Convert some ASCII sequences to their Unicode equivalents. This is disabled
# by default.
# - unicode_syntax:
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Applicative
import Control.Monad
import Database.PostgreSQL.Simple
import GHC.Generics (Generic)
{-# LANGUAGE KindSignatures #-}
module Lib where
data Console k =
Done k |
PrintLine String (Console k) |
ReadLine (String -> Console k)
instance Functor Console where
fmap f (Done a) = Done (f a)

"Specifiing distributed systems with TLA+"

Elevator pitch:

Learn how to use TLA+ to study, design and specify your algorithms. This workshop is designed to teach you about TLA+ from the ground up. We will start with simple distributed algorithms and slowly move toward more complex ones. Knowledge you gain can be immediatly applied at work next day after the workshop

Description:

TLA+ is a formal specification language developed by Leslie Lamport, designed to specify, model, document, and verify concurrent systems. It empowers your ability to clearly specify your design choices in the form of a formal specification, but also (even more importantly) can formally verify that your design choice is correct—meaning that it is both safe (does not break any rules) and live (over time it converges toward the result).

rn_stop() {
echo "stop all existing rnode processes"
kill $(ps aux | grep '[r]node' | awk '{print $2}')
}
rn_clean() {
echo "clean .rnode folders"
echo ~/.rnode*
rm -rf ~/.rnode*
echo "create bootstrap rnode folder"