I hereby claim:
- I am jonathanlorimer on github.
- I am jonathanlorimer (https://keybase.io/jonathanlorimer) on keybase.
- I have a public key ASAb-Ce7Wm_xSErNRTLCnG7b_wupUYXxu9JujmOK-b-r6wo
To claim this, I am signing this object:
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <style> | |
| body { | |
| margin: 0px; | |
| padding: 0px; | |
| } | |
| </style> | |
| </head> |
I hereby claim:
To claim this, I am signing this object:
| module FunctorInstances where | |
| import Test.QuickCheck | |
| newtype Identity a = Identity a | |
| deriving (Eq, Show) | |
| instance Functor Identity where | |
| fmap f (Identity a) = Identity (f a) |
| {-# LANGUAGE FlexibleInstances #-} | |
| module FunctorInstancesExercises where | |
| -- | 1. | |
| data Quant a b = Finance | |
| | Desk a | |
| | Bloor b | |
| instance Functor (Quant a) where |
| const productType = { a: 3, b: "hello", c: false } | |
| // this has the implied type data ProductType = { a :: Number, b :: String, c :: false } | |
| // even if javascript doesn't demand that we think about it, it matters | |
| // as demonstrated by the below function which IMPLICITLY expects that type signature | |
| const repeatWord = ({a, b, c}) => b + (c ? " " : "/n") + (a <= 0 ? "" : repeatWord({a: a - 1, b, c}) | |
| // if you give the above function the wrong 'type' you will get unexpected behaviour | |
| // rather than resulting in a type error you will get either a runtime error or an unexpected return value | |
| // Similarly you might have this |
| title | author | date | datePretty | description | tags | |
|---|---|---|---|---|---|---|
Intro to FP Through λ-Calc Part 1. - Motivating Laziness |
Jonathan Lorimer |
19/03/2020 |
Mar 19, 2020 |
Introduction to Functional Programming Through Lambda Calculus gave a thorough explanation of evaluation in lambda calculus, I found this helped motivate a better understanding of evaluation in haskell! |
|
| Cabal User Guide | |
| - Old Cabal User Guide | |
| - Section 1 | |
| - `cabal init` & `cabal run` | |
| - Adding dependencies to a cabal file | |
| - Relationship of `Main.hs` to `cabal run` | |
| - Section 2 | |
| - `cabal install` command | |
| - Local |
| Cabal Reference Summaries | |
| - Old Cabal User Guide | |
| - Section 1 | |
| - `cabal init` & `cabal run` | |
| - Adding dependencies to a cabal file | |
| - Relationship of `Main.hs` to `cabal run` | |
| - Section 2 | |
| - `cabal install` command | |
| - Local |
| public export | |
| data Fix : (Type -> Type) -> Type where | |
| Fx : f (Fix f) -> Fix f | |
| public export | |
| unfix : Fix f -> f (Fix f) | |
| public export | |
| interface (Functor f) => Recursive (f : Type -> Type) (t : Type) where | |
| project : t -> f t |
| --- Day 7: Some Assembly Required --- | |
| This year, Santa brought little Bobby Tables a set of wires and bitwise logic gates! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit. | |
| Each wire has an identifier (some lowercase letters) and can carry a 16-bit signal (a number from 0 to 65535). A signal is provided to each wire by a gate, another wire, or some specific value. Each wire can only get a signal from one source, but can provide its signal to multiple destinations. A gate provides no signal until all of its inputs have a signal. | |
| The included instructions booklet describes how to connect the parts together: x AND y -> z means to connect wires x and y to an AND gate, and then connect its output to wire z. | |
| For example: |