Skip to content

Instantly share code, notes, and snippets.

View therewillbecode's full-sized avatar

Tom therewillbecode

  • Edinburgh, UK
View GitHub Profile
View quotes.md

“Worry about data quality: Everything rests on the data.” ― David Spiegelhalter, The Art of Statistics: How to Learn from Data

“What am I not being told? This is perhaps the most important question of all.” ― David Spiegelhalter, The Art of Statistics: How to Learn from Data

“The numbers have no way of speaking for themselves. We speak for them. We imbue them with meaning. — Nate Silver, The Signal and the Noise1” ― David Spiegelhalter, The Art of Statistics: Learning from Data

@therewillbecode
therewillbecode / blog_post.md
Last active August 29, 2023 20:44
Blog Post on IO Monad.
View blog_post.md
12th April 2020

If Haskell is a pure functional language then how does anything get done?

Useful programs need to perform input/output or I/O if there are to interact with the outside world. How else would a program read files, print to the screen and interact with the external world. I/O is the process of responding to input signals from the external world and responding with output signals.

Haskell is a purely functional language. Let's define purity.

Purity is the property of functions which when given the same input always return the same output.

View machines.hs
module Main where
import Lib
import Data.Char
import Data.Machine
-- newtype CurrPlayerToAct = CurrPlayerToAct String deriving (Eq, Show, Ord)
@therewillbecode
therewillbecode / todo.hs
Last active November 11, 2021 14:14
To do List
View todo.hs
data User = User { email :: Text }
newtype TodoList = TodoList ([UTCTime, Map TodoId Todo])
newtype UserLists = UserLists (Map Email [TodoList])
newtype TodoId = TodoId Int
data Todo = Todo
{ description :: Description,
@therewillbecode
therewillbecode / math_insights.md
Last active December 27, 2020 11:21
math_insights
View math_insights.md

Number theory

Primes are the atoms of the integers.

Fundamental theorem of arithmetic

Absolute values and inequalities

Remember to flip inequalities when taking the reciprocal of both sides or multiplying/diving both sides by a negative.

@therewillbecode
therewillbecode / papers.md
Last active August 30, 2020 08:32
Papers I like
View papers.md
@therewillbecode
therewillbecode / haskell_exceptions_notes.md
Last active April 25, 2020 13:29
Exceptions in Haskell Notes
View haskell_exceptions_notes.md

Exceptions

All code that runs in IO can experience exceptions of any type.

Remember you can only catch an exception in IO. But it is possible to throw exceptions from pure code. An example of this is error.

Throw doesn't throw until forced

Due to laziness the order of evaluation of expressions can be modified by the compiler. This means that throw can return an

View gist:736efa318fb6874956e92cbc87c32483
Code by Petzold
Nand2Tetris
Ben Eater 6502 breadboard project
Computerphile how memory works
https://www.youtube.com/watch?v=XETZoRYdtkw
https://www.youtube.com/watch?v=-Ecf7lb4aZ0
View gist:fea4a5c2437ea5b15018c4860cf5ba07
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Socket.Table where
import Control.Concurrent hiding ( yield )
import Control.Concurrent.Async
import Control.Concurrent.STM
import qualified Data.Map.Lazy as M
import Database.Persist.Postgresql
import qualified Network.WebSockets as WS