• Stars
    star
    437
  • Rank 99,659 (Top 2 %)
  • Language
    Haskell
  • License
    Other
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📖 source material for Thinking with Types

Thinking with Types

Dedication

I was terrible in English. I couldn't stand the subject. It seemed to me ridiculous to worry about whether you spelled something wrong or not, because English spelling is just a human convention---it has nothing to do with anything real, anything from nature.

Richard P. Feynman

Overview

This repository is all of the original source material for my book Thinking with Types: Type-Level Programming in Haskell. If you're curious about what goes into writing a book, it might be a good place to peruse.

Building this thing is particularly hard; I had to write three separate build tools, and patch a few upstream libraries. You're free to try to figure it out, but I'd suggest just buying a copy instead!

Don't make me regret open-sourcing this.

Commentary

My overarching organizational principle for this book was to make it as hard as possible to fuck up. That meant that code samples should automatically be tested, GHCi sessions should be automated, solutions and exercises should be co-located, and that there is always a clearly defined source of truth for all material.

The result was a joy to write, but remarkably terrible to deal with after the fact. Paying a marginal compile-time cost of 1s per code example is fine on a chapter-by-chapter basis, but my god does it add up when building the entire project.

Doing it in LaTeX was good for the short-term, but turned into an eventual liability. LaTeX is sweet for quickly producing good-looking pdf documents, but it's sort of the worst of all worlds. It's sort of a content-language, and sort of a real programming language, and doesn't force you into either paradigm. As a result, there was lots of weird fiddling in order to get something to look right---without knowing how it really works or without any discipline.

For writing a thesis or a report, this is fine, but the problem is an eternal one: it's not denotational. LaTeX emphasizes how to do it rather than what to do. The difference bites you in the ass when you want to produce an ebook, for example. You can't use LaTeX to produce the ebook, but you also can't not use LaTeX, because you've automated necessary things in its shitty programming environment.

Also, the tooling breaks all the time, seemingly without any sort of discernible reason.

If I were to do this project again, knowing what I know now, I would write the entire book as a series of Haskell modules. I'd use quasiquoters to write inline prose and build meaningful abstractions in a principled, well-understood language. In essence, I'd write a book DSL, and then write interpretations of that into my eventual desired formats.

License

This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

More Repositories

1

algebra-driven-design

Source material for Algebra-Driven Design
Haskell
113
star
2

cornelis

agda-mode for neovim
Haskell
96
star
3

ecstasy

💊 a GHC.Generics-based entity component system
Haskell
78
star
4

type-errors

⚠️ tools for writing better type errors
Haskell
73
star
5

suavemente

💃 an applicative functor that seamlessly talks to HTML inputs
Haskell
71
star
6

cccc

🖼️ the compiling to closed categories compiler
Haskell
66
star
7

type-sets

type level sets
Haskell
65
star
8

typecraft

⭐ it's a starcraft clone but with a dope typesystem
Haskell
47
star
9

do-notation

deprecated in favor of -XQualifiedDo
Haskell
41
star
10

algebra-checkers

checkers for algebra driven design
Haskell
34
star
11

jazz

i bet you there is a typesystem behind music
JavaScript
30
star
12

adventure

an open-source MOAI based point-n-click graphical adventure engine
Lua
26
star
13

same-same

🤳 ignore the differences between `a` and `Identity a`
Haskell
25
star
14

prospect

⛏️ static analysis of free monads
Haskell
25
star
15

dynahaskell

the dynabook but for haskell
Haskell
23
star
16

certainty-by-construction

Agda
23
star
17

sequoia

🌳 a monadic FRP game library for haskell
Haskell
23
star
18

reasonablypolymorphic.com

⏳ my math blog
HTML
23
star
19

nimic

a language about nothing
Haskell
19
star
20

constraints-emerge

📤 defer instance resolution until runtime
Haskell
18
star
21

afro-kravitz

it's a guitar jammer
Elm
18
star
22

latex-live-snippets

deprecated by `design-tools`
Haskell
17
star
23

marlo

a search engine for humans
HTML
17
star
24

wide-open-world

the global haskell instance repository
Haskell
16
star
25

containers-good-graph

It's Data.Graph, but it doesn't suck!
Haskell
16
star
26

ghci.vim

↔️ tight ghci integration for vim
Vim Script
16
star
27

th-dict-discovery

🐙 discover Dicts
Haskell
14
star
28

hs2

a new, WIP Haskell compiler
C
14
star
29

circuitry

the missing haskell circuit diagram library
Haskell
13
star
30

talks

repository for talks I'm giving
Haskell
12
star
31

nullification

the game i've wanted to exist for a decade
Haskell
12
star
32

ldtk-types

Types for ldtk
Haskell
12
star
33

transitive-anns

transitively track and reify annotations across a codebase
Haskell
11
star
34

blagda

agda blogging based on 1lab
Agda
11
star
35

time2jam

🏀 an FRP basketball video game
Haskell
10
star
36

httw

is it a new book???
Haskell
10
star
37

tino

new dotfiles system
Vim Script
10
star
38

canada-t

🇨🇦 the canada monad transformer
Haskell
9
star
39

ld52

Haskell
9
star
40

lasercutter

high-powered tree parser
HTML
9
star
41

wheatley

haskell++
Haskell
8
star
42

haskellwingman.dev

HTML
8
star
43

compiling-to-categories-redux

we're TRYING AGAIN with @maybevoid
Haskell
8
star
44

wfc

wave function collapse
C#
8
star
45

jps

👉 jump point search for Haskell
Haskell
8
star
46

hs-vexflow

a haskell DSL for generating vexflow
Haskell
8
star
47

hatred

haskell typesetting
Haskell
8
star
48

design-tools

tools for design and interpretation of haskell programs
Haskell
8
star
49

hskit

luakit but in haskell
Haskell
8
star
50

lesswrong-chronological-ebook

All of Eliezer's Overcoming Bias / Less Wrong posts, in chronological order, in one handy epub
Shell
7
star
51

iwmag

it's a platformer written on top of sequoia and ecstasy
Haskell
7
star
52

textbooks

Writing textbooks is a good way to learn things
TeX
7
star
53

take2

the real accio analytics platform
Scala
7
star
54

neptune

🚂
Haskell
7
star
55

ngs

no giant strings
Haskell
7
star
56

reviews

Repository for technical reviews I do
Haskell
7
star
57

seasoned-pine

it's like anki but it sucks less
Haskell
7
star
58

free-m32

linux HID driver for Native Instruments M32
Haskell
7
star
59

sandymaguire.me

http://sandymaguire.me
HTML
6
star
60

denotational-arithmetic-zurihac

Agda
6
star
61

composition

6
star
62

lua-stg

a STG interpreter in lua
Lua
6
star
63

the-millions-of-gestures

the millions of gestures that constitute life on earth
TeX
6
star
64

haskell-realtime-midi

realtime streaming midi events from instruments
Haskell
6
star
65

arduino

My arduino projects
C++
6
star
66

bones

haskell skeletal animation support for Spriter exported .scon files
Haskell
6
star
67

pplmonad-mirror

mirror of https://hub.darcs.net/linearity/pplmonad
Haskell
6
star
68

type-diagrams

draw types in the style of Thinking with Types' cover
Haskell
6
star
69

magic-debug

A GHC plugin to magically print any type you want
Haskell
5
star
70

free-est

Haskell
5
star
71

category-theory

awoooodeyyyy
Haskell
5
star
72

eden

an editor of perfect happiness and bliss
Haskell
5
star
73

math-fracking

HIGHLY PRESSURIZED MATH EXTRACTION
Haskell
5
star
74

papers

I will read and engage with one paper a week.
5
star
75

circus

dot but in hs
Haskell
5
star
76

everyone-screams-for-haskell

let's write a compiler
Haskell
5
star
77

agda-playground

Agda
4
star
78

THE-POLKANATOR

oompah oompah
Haskell
4
star
79

erdos

HTML
4
star
80

conceptual-mathematics

Agda
4
star
81

juicy

the slickest, wettest, sexiest compiler
Scala
4
star
82

percentile-feedback

CoffeeScript
4
star
83

autogenparfunpro

automatic generic parallel function programming
Agda
4
star
84

sandbox

trying to grok dependent types
Haskell
4
star
85

rpg-gen

a procedurally generated RPG
Haskell
4
star
86

goal-tracker

Haskell
4
star
87

math135

lean proofs of math135
Lean
4
star
88

canlii-scraper

Python
4
star
89

lets-recurse

exercises with recursion schemes
Haskell
4
star
90

social-calendar

get emails when you want to see people
Haskell
4
star
91

data-quadtree

algebraic quadtree
Haskell
4
star
92

qkontrol-mirror

mirror of https://www.native-instruments.com/forum/threads/qkontrol-an-open-source-mapping-editor-for-the-komplete-kontrol-mk2-on-linux-and-mac.333887/
C++
4
star
93

shiatsu

massage text documents
Haskell
3
star
94

ld53

Haskell
3
star
95

improvised

🎷 test Haskell with ease
Haskell
3
star
96

futarchy

Blockchain based democracy
Haskell
3
star
97

desklights

a little program to control the color of my desk
Haskell
3
star
98

provenance

track data provenance
Haskell
3
star
99

rust-exercises

Rust
3
star
100

iwmag2

BOOOOOORED
Haskell
3
star