Awake Security will be livestreaming a periodic 1-on-1 teaching session on Twitch. The subject of this session will always be one of our engineers teaching another one of our engineers how to do accomplish a practical task in Haskell while remote attendees watch, comment, and ask questions.
This file contains hidden or 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
let | |
nixpkgs = builtins.fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz"; | |
sha256 = "0q7rnlp1djxc9ikj89c0ifzihl4wfvri3q1bvi75d2wrz844b4lq"; | |
}; | |
config = { | |
allowUnfree = true; | |
}; |
This file contains hidden or 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
steps: | |
- module_header: | |
open_bracket: next_line | |
separate_lists: false | |
sort: false | |
- imports: | |
align: group | |
pad_module_names: false | |
long_list_align: new_line_multiline | |
separate_lists: false |
This file contains hidden or 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 ApplicativeDo #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Control.Concurrent.Async (Concurrently(..)) | |
import Data.Foldable (traverse_) | |
import Data.List.NonEmpty (NonEmpty(..)) | |
import Data.Text (Text) | |
import Foreign.C |
This file contains hidden or 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
-- long brute force solution to exercise 7 on p. 20 of "Conceptual Mathematics" | |
-- if you don't have haskell on your computer, paste all this into: | |
-- https://replit.com/languages/haskell | |
-- this is how we define a data type in Haskell. think of it as a set | |
data Bit = Zero | One deriving (Show, Eq) | |
-- the last part tells Haskell to figure out how to print Bits, and that | |
-- Zero equals Zero, One equals One, and Zero is different from One | |
-- this is a type declaration. think domain and codomain |
This file contains hidden or 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 DefaultSignatures #-} | |
{-# LANGUAGE DeriveAnyClass #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE EmptyDataDeriving #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} |
This file contains hidden or 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 DeriveGeneric #-} | |
{-# LANGUAGE DeriveAnyClass #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TypeApplications #-} | |
module Main where | |
import Data.Csv (FromField, FromNamedRecord) | |
import Data.Text (Text) | |
import Data.Map (Map) |
This file contains hidden or 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
let prologue = | |
{| | |
{-# language DeriveGeneric #-} | |
module Parser where | |
import Data.Csv | |
import qualified Data.Vector as V | |
import qualified Data.ByteString.Char8 as BS | |
import qualified Data.ByteString.Lazy.Char8 as BSL | |
import GHC.Generics | |
import Control.Monad |
This file contains hidden or 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
module Lambda where | |
import qualified Data.Map as M | |
import Data.Maybe | |
import Control.Monad.State.Strict | |
import Debug.Trace | |
data Term = Lam String Term | |
| Var String | |
| App Term Term | |
| KonstInt Int |
Prediction as of 3/15/2019 JST:
- Bitfinex is insolvent, for the Bitcoin economy's usual quixotic definition of insolvent.
- This happened as a result of collateralizing Tether with BTC and other cryptocurrencies during the run-up.
- Bitfinex / Tether treat whether Bitfinex held the collateral or Tether held the collateral as a material distinction, but that's ridiculous due to common control. The important fact: in 2018, ground truth diverged from "There is $1 in a bank account for every tether outstanding" to "There is $1 in a bank account and/or $1 worth of Bitcoin at prevailing prices available to Bitfinex for every tether outstanding."
- This makes Tether synthetically long Bitcoin, via a receivable from Bitfinex. Bitfinex took the newly issued Tether and then, since this accounting shellgame appears to balance its books and leave it with surplus Bitcoin, either sold or lent the Bitcoin to short sellers during the run-up.
- If Bitfinex simply sold the Bitcoin, they're doing relatively well for themselve
NewerOlder