mirror of
https://github.com/hmemcpy/milewski-ctfp-pdf.git
synced 2024-11-25 07:52:03 +03:00
refactor: CI and nix (#306)
* fix: remove custom fonts Since they are available in Nix, there is no need to keep them in the project anymore * chore: remove old obsolete files * refactor: rewrite Nix files - Switch from `numtide/flake-utils` to `flake-parts` - Add custom font derivation for LaTeX - Add `formatter` - Switch to `python311` * ci: update Github workflows * feat: add `Makefile` for local development Very useful when used in combination with `nix develop` * feat: add `.envrc` file for loading development environment with `nix-direnv` * feat: add `.editorconfig` and `.prettierrc` * style: reformat files using `prettier` Run `nix run nixpkgs#nodePackages.prettier -- --write .` * fix: add workaround to prevent bug with `minted` package see https://github.com/gpoore/minted/issues/353 for context * fix: add `version.tex` in the repo * chore: rewrite `README` * chore: ignore LaTeX temporary files while building locally * feat: add `latexindent.pl` configuration file * style: lint LaTeX files
This commit is contained in:
parent
98b71ac267
commit
de799935b2
21
.editorconfig
Normal file
21
.editorconfig
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_size = 4
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.{tex,cls,lua,nix}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
max_line_length = 80
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
indent_size = 2
|
||||||
|
max_line_length = 80
|
51
.github/settings.yml
vendored
Normal file
51
.github/settings.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# https://github.com/probot/settings
|
||||||
|
|
||||||
|
branches:
|
||||||
|
- name: master
|
||||||
|
protection:
|
||||||
|
enforce_admins: false
|
||||||
|
required_pull_request_reviews:
|
||||||
|
dismiss_stale_reviews: true
|
||||||
|
require_code_owner_reviews: true
|
||||||
|
required_approving_review_count: 1
|
||||||
|
restrictions: null
|
||||||
|
required_linear_history: true
|
||||||
|
required_status_checks:
|
||||||
|
strict: true
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- name: typo
|
||||||
|
color: ee0701
|
||||||
|
|
||||||
|
- name: dependencies
|
||||||
|
color: 0366d6
|
||||||
|
|
||||||
|
- name: enhancement
|
||||||
|
color: 0e8a16
|
||||||
|
|
||||||
|
- name: question
|
||||||
|
color: cc317c
|
||||||
|
|
||||||
|
- name: security
|
||||||
|
color: ee0701
|
||||||
|
|
||||||
|
- name: stale
|
||||||
|
color: eeeeee
|
||||||
|
|
||||||
|
repository:
|
||||||
|
allow_merge_commit: true
|
||||||
|
allow_rebase_merge: true
|
||||||
|
allow_squash_merge: true
|
||||||
|
default_branch: master
|
||||||
|
description:
|
||||||
|
"Bartosz Milewski's 'Category Theory for Programmers' unofficial PDF and
|
||||||
|
LaTeX sources"
|
||||||
|
homepage: https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
|
||||||
|
topics: pdf,haskell,scala,latex,cpp,functional-programming,ocaml,category-theory
|
||||||
|
has_downloads: true
|
||||||
|
has_issues: true
|
||||||
|
has_pages: false
|
||||||
|
has_projects: false
|
||||||
|
has_wiki: false
|
||||||
|
name: milewski-ctfp-pdf
|
||||||
|
private: false
|
117
.github/workflows/build.yaml
vendored
117
.github/workflows/build.yaml
vendored
@ -1,117 +0,0 @@
|
|||||||
name: Build PDFs
|
|
||||||
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
dependencies:
|
|
||||||
name: Build dependencies
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
version: ${{ steps.version.outputs.version }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set up Git repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Create global variables
|
|
||||||
id: version
|
|
||||||
run: echo "::set-output name=version::$(git rev-parse --short HEAD)"
|
|
||||||
|
|
||||||
determine-matrix:
|
|
||||||
name: Figure out the packages we need to build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [dependencies]
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set up Git repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Install the Nix package manager
|
|
||||||
uses: cachix/install-nix-action@v16
|
|
||||||
|
|
||||||
- id: set-matrix
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=matrix::$(
|
|
||||||
nix eval --json --impure \
|
|
||||||
--expr 'builtins.attrNames (import ./.).packages.x86_64-linux'
|
|
||||||
)"
|
|
||||||
|
|
||||||
build:
|
|
||||||
name: Build documents
|
|
||||||
needs: determine-matrix
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set up Git repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Install Nix
|
|
||||||
uses: cachix/install-nix-action@v16
|
|
||||||
|
|
||||||
- name: Build ${{ matrix.packages }}.pdf
|
|
||||||
run: |
|
|
||||||
nix build .#${{ matrix.packages }}
|
|
||||||
mkdir -p out
|
|
||||||
cp -ar ./result/* out/
|
|
||||||
|
|
||||||
- name: Upload build assets (${{ matrix.packages }}.pdf)
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ctfp
|
|
||||||
path: out/*
|
|
||||||
|
|
||||||
release:
|
|
||||||
name: "Create Github tag/pre-release"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [dependencies, build]
|
|
||||||
outputs:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
steps:
|
|
||||||
- name: Create Github pre-release (${{ needs.dependencies.outputs.version }})
|
|
||||||
id: create_release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: v${{ github.run_number }}-${{ needs.dependencies.outputs.version }}
|
|
||||||
release_name: Version ${{ github.run_number }} (${{ needs.dependencies.outputs.version }})
|
|
||||||
draft: false
|
|
||||||
prerelease: true
|
|
||||||
|
|
||||||
assets:
|
|
||||||
name: Upload release assets
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [determine-matrix, dependencies, release]
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Download build assets (${{ matrix.packages }}.pdf)
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ctfp
|
|
||||||
path: ctfp
|
|
||||||
|
|
||||||
- name: Upload release assets (${{ matrix.packages }}--${{ needs.dependencies.outputs.version }}.pdf)
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: ctfp/${{ matrix.packages }}.pdf
|
|
||||||
asset_name: ${{ matrix.packages }}--${{ needs.dependencies.outputs.version }}.pdf
|
|
||||||
asset_content_type: application/pdf
|
|
64
.github/workflows/nix-flake-check.yaml
vendored
Normal file
64
.github/workflows/nix-flake-check.yaml
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
name: Check and build
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
dependencies:
|
||||||
|
name: Build dependencies
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Create global variables
|
||||||
|
id: version
|
||||||
|
run:
|
||||||
|
echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
determine-matrix:
|
||||||
|
name: Figure out the packages we need to build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [dependencies]
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install the Nix package manager
|
||||||
|
uses: cachix/install-nix-action@v18
|
||||||
|
|
||||||
|
- id: set-matrix
|
||||||
|
run: |
|
||||||
|
echo "matrix=$(
|
||||||
|
nix eval --json .#packages.x86_64-linux --apply builtins.attrNames
|
||||||
|
)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
needs: determine-matrix
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: cachix/install-nix-action@v18
|
||||||
|
|
||||||
|
- name: Nix flake check
|
||||||
|
run: nix flake check
|
||||||
|
|
||||||
|
- name: Build ${{ matrix.packages }}.pdf
|
||||||
|
run: nix build .#${{ matrix.packages }}
|
17
.github/workflows/nix-fmt-checks.yaml
vendored
Normal file
17
.github/workflows/nix-fmt-checks.yaml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: Nix formatter checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
format-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: cachix/install-nix-action@v18
|
||||||
|
|
||||||
|
- name: Run nix formatter tool
|
||||||
|
run: nix fmt . -- --check
|
18
.github/workflows/prettier-checks.yaml
vendored
Normal file
18
.github/workflows/prettier-checks.yaml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
name: Prettier checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prettier:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install the Nix package manager
|
||||||
|
uses: cachix/install-nix-action@v18
|
||||||
|
|
||||||
|
- name: Checks
|
||||||
|
run: nix run nixpkgs#nodePackages.prettier -- --check .
|
99
.github/workflows/release.yaml
vendored
Normal file
99
.github/workflows/release.yaml
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
name: Release PDFs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
determine-matrix:
|
||||||
|
name: Figure out the assets we need to build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install the Nix package manager
|
||||||
|
uses: cachix/install-nix-action@v18
|
||||||
|
|
||||||
|
- id: set-matrix
|
||||||
|
run: |
|
||||||
|
echo "matrix=$(
|
||||||
|
nix eval --json --impure \
|
||||||
|
--expr 'builtins.filter (x: (null == builtins.match "(.*)-nts" x)) (builtins.attrNames (import ./.).packages.x86_64-linux)'
|
||||||
|
)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build documents
|
||||||
|
needs: determine-matrix
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: cachix/install-nix-action@v18
|
||||||
|
|
||||||
|
- name: Build ${{ matrix.packages }}.pdf
|
||||||
|
run: |
|
||||||
|
nix build .#${{ matrix.packages }}
|
||||||
|
mkdir -p out
|
||||||
|
cp -ar ./result/* out/
|
||||||
|
|
||||||
|
- name: Upload build assets (${{ matrix.packages }}.pdf)
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ctfp
|
||||||
|
path: out/*
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: "Create Github pre-release"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build]
|
||||||
|
outputs:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
steps:
|
||||||
|
- name: Create Github pre-release (${{ github.ref }})
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: ${{ github.ref }}
|
||||||
|
draft: true
|
||||||
|
|
||||||
|
assets:
|
||||||
|
name: Upload release assets
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [determine-matrix, release]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
packages: ${{fromJson(needs.determine-matrix.outputs.matrix)}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download build assets (${{ matrix.packages }}.pdf)
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ctfp
|
||||||
|
path: ctfp
|
||||||
|
|
||||||
|
- name:
|
||||||
|
Upload release assets (${{ matrix.packages }}--${{ github.ref
|
||||||
|
}}.pdf)
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
||||||
|
asset_path: ctfp/${{ matrix.packages }}.pdf
|
||||||
|
asset_name: ${{ matrix.packages }}--${{ github.ref }}.pdf
|
||||||
|
asset_content_type: application/pdf
|
28
.gitignore
vendored
28
.gitignore
vendored
@ -1,16 +1,26 @@
|
|||||||
.vscode/
|
/.vscode/
|
||||||
*.fls
|
/.direnv/
|
||||||
|
/build/
|
||||||
|
/result
|
||||||
|
.DS_Store
|
||||||
|
src/.dotty-ide-disabled
|
||||||
|
src/.metals
|
||||||
|
out/
|
||||||
_minted*
|
_minted*
|
||||||
*.fdb_latexmk
|
*.fls
|
||||||
out/*
|
out/*
|
||||||
|
*.fdb_latexmk
|
||||||
|
*.bak*
|
||||||
|
*.log
|
||||||
*.pdf
|
*.pdf
|
||||||
*.xdv
|
*.xdv
|
||||||
*.gz
|
*.gz
|
||||||
src/version.tex
|
|
||||||
*.pyg
|
*.pyg
|
||||||
*.synctex(busy)
|
*.synctex(busy)
|
||||||
src/.dotty-ide-disabled
|
*.aux
|
||||||
venv/*
|
*.idx
|
||||||
.DS_Store
|
*.ilg
|
||||||
src/.metals
|
*.lig
|
||||||
out/
|
*.ind
|
||||||
|
*.out
|
||||||
|
*.toc
|
||||||
|
7
.latexindent.yaml
Normal file
7
.latexindent.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
defaultIndent: " "
|
||||||
|
verbatimEnvironments:
|
||||||
|
verbatim: 1
|
||||||
|
lstlisting: 1
|
||||||
|
minted: 1
|
||||||
|
snip: 1
|
||||||
|
snipv: 1
|
6
.prettierignore
Normal file
6
.prettierignore
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/.direnv/
|
||||||
|
/.idea/
|
||||||
|
/vendor/
|
||||||
|
/docs/
|
||||||
|
/build/
|
||||||
|
CHANGELOG.md
|
3
.prettierrc
Normal file
3
.prettierrc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"proseWrap": "always"
|
||||||
|
}
|
32
.travis.yml
32
.travis.yml
@ -1,32 +0,0 @@
|
|||||||
language:
|
|
||||||
- nix
|
|
||||||
|
|
||||||
script:
|
|
||||||
- nix-shell --pure --command 'cd src; make all'
|
|
||||||
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
src/_minted-ctfp
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
- provider: releases
|
|
||||||
api_key:
|
|
||||||
secure: usNWQZc/HcrZxR72+Qz2YXeyf56h0EwLVl6oOXIivxTWQCTTQ0cE6tXG6lP8JxQ1qlfAhbdh4QOmz6jxQD60HxsUwDWmt9t51o+8n3EMeID0hc45ES40/mbieUfR1jbkLbwmL16Z/bWsvUErmGuUgOxYrUCplK9fWs7Vvt8xmReFdunw8XpVrywG4rl1jXDo9YWihMps5KLOqd3mY3yvlxAmB+UKkhHPNdcEuEghEBhC8HZoZkFiwfRw/8PeOh9VpnQ2ht9eDXOlB7zNYY9Xr/S98FbzfZXxFjApXVRgNP8k2UYyHn8HCmIoCSs+Jv06tEvNCuwTvj0JNsuoW7vu/Q7wrrpScfDL+WnSw2CScml+xAe7Q4caoZKkzaMCnj5fHbPEZ731+SLZNbG6TMTYhMqhFm0Fr87bwdNlayqAssIhOwU4ca3pnZOQFO4vNOWblNfbHsX5F9sJDOR0uD4Y+PgfNWgTsssXqei7owBJNTe+qz5Q7IaFA3A8EMp57CV1dUCgmjxVuugtz6DLpl16WGiWpqakIA900GXMG+2c4ENCCDWmYtGlpWs2lSBqRYHV1gncE8UGtIih8G6g5jQd2aJUQKHKuaEiv/28WLI7f2exUuOBmc0ce4xP+qZAs5XWiPo4jJLNyb81uNIZ0jCb/c5+lEH8EsYF+jFOrmw17GQ=
|
|
||||||
file: out/**/*.pdf
|
|
||||||
file_glob: true
|
|
||||||
skip_cleanup: true
|
|
||||||
on:
|
|
||||||
repo: hmemcpy/milewski-ctfp-pdf
|
|
||||||
branch: master
|
|
||||||
tags: true
|
|
||||||
- provider: s3
|
|
||||||
bucket: milewski-ctfp-pdf
|
|
||||||
access_key_id: '$ARTIFACTS_KEY'
|
|
||||||
secret_access_key: '$ARTIFACTS_SECRET'
|
|
||||||
region: us-east-1
|
|
||||||
acl: public_read
|
|
||||||
local_dir: out
|
|
||||||
skip_cleanup: true
|
|
||||||
on:
|
|
||||||
all_branches: true
|
|
||||||
repo: hmemcpy/milewski-ctfp-pdf
|
|
31
Makefile
Normal file
31
Makefile
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
OUTPUT ?= $(shell basename "$(shell dirname "$(INPUT)")")
|
||||||
|
OUTPUT_DIRECTORY = $(shell pwd)/build
|
||||||
|
LATEXMK_ARGS ?= -f -file-line-error -shell-escape -logfilewarninglist -interaction=nonstopmode -halt-on-error -norc -pdflatex="xelatex %O %S" -pdfxe
|
||||||
|
TEXINPUTS = ""
|
||||||
|
TEXLIVE_RUN = TEXINPUTS=$(TEXINPUTS)
|
||||||
|
LATEXMK_COMMAND = $(TEXLIVE_RUN) latexmk $(LATEXMK_ARGS)
|
||||||
|
|
||||||
|
# Make does not offer a recursive wildcard function, so here's one:
|
||||||
|
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
|
||||||
|
|
||||||
|
ctfp:
|
||||||
|
cd src; $(LATEXMK_COMMAND) -jobname=ctfp ctfp-reader.tex
|
||||||
|
|
||||||
|
ctfp-ocaml:
|
||||||
|
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-ocaml ctfp-reader-ocaml.tex
|
||||||
|
|
||||||
|
ctfp-scala:
|
||||||
|
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-scala ctfp-reader-scala.tex
|
||||||
|
|
||||||
|
ctfp-print:
|
||||||
|
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-print ctfp-print.tex
|
||||||
|
|
||||||
|
ctfp-print-ocaml:
|
||||||
|
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-print-ocaml ctfp-print-ocaml.tex
|
||||||
|
|
||||||
|
ctfp-print-scala:
|
||||||
|
cd src; $(LATEXMK_COMMAND) -jobname=ctfp-print-scala ctfp-print-scala.tex
|
||||||
|
|
||||||
|
lint:
|
||||||
|
$(foreach file, $(call rwildcard,$(shell dirname "$(INPUT)"),*.tex), latexindent -l -w $(file);)
|
||||||
|
|
140
README.md
140
README.md
@ -1,76 +1,106 @@
|
|||||||
Category Theory for Programmers
|
![GitHub stars][github stars]
|
||||||
====
|
[![GitHub Workflow Status][github workflow status]][github actions link]
|
||||||
![image](https://user-images.githubusercontent.com/601206/43392303-f770d7be-93fb-11e8-8db8-b7e915b435ba.png)
|
[![Download][download badge]][github latest release]
|
||||||
<b>Direct link: [category-theory-for-programmers.pdf](https://github.com/hmemcpy/milewski-ctfp-pdf/releases/download/v1.3.0/category-theory-for-programmers.pdf)</b>
|
[![License][license badge]][github latest release]
|
||||||
(Latest release: v1.3.0, August 2019. See [releases](https://github.com/hmemcpy/milewski-ctfp-pdf/releases) for additional formats and languages.)
|
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/hmemcpy/milewski-ctfp-pdf.svg?branch=master)](https://travis-ci.org/hmemcpy/milewski-ctfp-pdf)
|
# Category Theory For Programmers
|
||||||
[(latest CI build)](https://s3.amazonaws.com/milewski-ctfp-pdf/category-theory-for-programmers.pdf)
|
|
||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/601206/47271389-8eea0900-d581-11e8-8e81-5b932e336336.png"
|
An _unofficial_ PDF version of "**C**ategory **T**heory **F**or **P**rogrammers"
|
||||||
alt="Buy Category Theory for Programmers" width=410 />
|
by [Bartosz Milewski][bartosz github], converted from his [blogpost
|
||||||
**[Available in full-color hardcover print](https://www.blurb.com/b/9621951-category-theory-for-programmers-new-edition-hardco)**
|
series][blogpost series] (_with permission!_).
|
||||||
Publish date: 12 August, 2019. Based off release tag [v1.3.0](https://github.com/hmemcpy/milewski-ctfp-pdf/releases/tag/v1.3.0). See [errata-1.3.0](errata-1.3.0.md) for changes and fixes since print.
|
|
||||||
|
|
||||||
**[Scala Edition is now available in paperback](https://www.blurb.com/b/9603882-category-theory-for-programmers-scala-edition-pape)**
|
![Category Theory for Programmers][ctfp image]
|
||||||
Publish date: 12 August, 2019. Based off release tag [v1.3.0](https://github.com/hmemcpy/milewski-ctfp-pdf/releases/tag/v1.3.0). See [errata-scala](errata-scala.md) for changes and fixes since print.
|
|
||||||
|
|
||||||
This is an *unofficial* PDF version of "Category Theory for Programmers" by Bartosz Milewski, converted from his [blogpost series](https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/) (with permission!)
|
## Buy the book
|
||||||
|
|
||||||
---
|
- **[Standard edition in full-color hardcover
|
||||||
|
print][buy regular edition on blurb]**
|
||||||
|
- Publish date: 12 August, 2019.
|
||||||
|
- Based off release tag [v1.3.0][v1.3.0 github release link]. See
|
||||||
|
[errata-1.3.0](errata-1.3.0.md) for changes and fixes since print.
|
||||||
|
- **[Scala Edition in paperback][buy scala edition on blurb]**
|
||||||
|
- Publish date: 12 August, 2019.
|
||||||
|
- Based off release tag [v1.3.0][v1.3.0 github release link]. See
|
||||||
|
[errata-scala](errata-scala.md) for changes and fixes since print.
|
||||||
|
|
||||||
Building
|
## Build the book
|
||||||
--------
|
|
||||||
|
|
||||||
The best way to build the book is using the [Nix](https://nixos.org/nix/) package manager. After [installing Nix](https://nixos.org/download.html), if you're using a non-NixOS operating system, you need to install `nixFlakes` in your environment following the steps below ([source](https://nixos.wiki/wiki/Flakes#Non-NixOS)):
|
The building workflow requires [Nix][nix website]. After [installing
|
||||||
|
Nix][nix download website], you need to enable the upcoming "flake" feature
|
||||||
|
which must be [enabled manually][nixos wiki flake] the time being. This is
|
||||||
|
needed to expose the new Nix commands and flakes support that are hidden behind
|
||||||
|
feature-flags.
|
||||||
|
|
||||||
```bash
|
Afterwards, type `nix flake show` in the root directory of the project to see
|
||||||
$ nix-env -iA nixpkgs.nixFlakes
|
all the available versions of this book. Then type `nix build .#<edition>` to
|
||||||
```
|
build the edition you want (Haskell, Scala, OCaml, Reason and their printed
|
||||||
|
versions). For example, to build the Scala edition you'll have to type
|
||||||
|
`nix build .#ctfp-scala`.
|
||||||
|
|
||||||
Edit either `~/.config/nix/nix.conf` or `/etc/nix/nix.conf` and add:
|
Upon successful compilation, the PDF file will be placed in the `result`
|
||||||
|
directory.
|
||||||
|
|
||||||
```
|
The command `nix develop` will provide a shell containing all the required
|
||||||
experimental-features = nix-command flakes
|
dependencies to build the book manually using the provided `Makefile`. To build
|
||||||
```
|
the `ctfp-scala` edition, just run `make ctfp-scala`.
|
||||||
|
|
||||||
This is needed to expose the Nix 2.0 CLI and flakes support that are hidden behind feature-flags.
|
## Contribute
|
||||||
|
|
||||||
Also, if the Nix installation is in multi-user mode, don’t forget to restart the nix-daemon.
|
Contributors are welcome to contribute to this book by sending pull-requests.
|
||||||
|
Once reviewed, the changes are merged in the main branch and will be
|
||||||
|
incorporated in the next release.
|
||||||
|
|
||||||
Afterwards, type `nix flake show` in the root directory of the project to see all the available versions of this book. Then type `nix build .#<edition>` to build the edition you want (Haskell, Scala, OCaml, Reason and their printed versions). For example, to build the Scala edition you'll have to type `nix build .#ctfp-scala`.
|
**Note from [Bartosz][bartosz github]**: I really appreciate all your
|
||||||
|
contributions. You made this book much better than I could have imagined. Thank
|
||||||
|
you!
|
||||||
|
|
||||||
Upon successful compilation, the PDF file will be placed in the `result` directory inside the root directory `milewski-ctfp-pdf` of the repository.
|
Find the [list of contributors on Github][contributors].
|
||||||
|
|
||||||
The file `preamble.tex` contains all the configuration and style declarations.
|
## Acknowledgements
|
||||||
|
|
||||||
Acknowledgements
|
PDF LaTeX source and the tools to create it are based on the work by [Andres
|
||||||
----------------
|
Raba][andres raba github]. The book content is taken, with permission, from
|
||||||
|
[Bartosz Milewski][bartosz github]'s blogpost series, and adapted to the LaTeX
|
||||||
|
format.
|
||||||
|
|
||||||
PDF LaTeX source and the tools to create it are based on the work by Andres Raba et al., available here: https://github.com/sarabander/sicp-pdf.
|
The original blog post acknowledgments by Bartosz are consolidated in the
|
||||||
The book content is taken, with permission, from Bartosz Milewski's blogpost series, and adapted to the LaTeX format.
|
_Acknowledgments_ page at the end of the book.
|
||||||
|
|
||||||
Thanks to the following people for contributing corrections/conversions and misc:
|
## License
|
||||||
|
|
||||||
* Oleg Rakitskiy
|
The PDF book, `.tex` files, and associated images and figures in directories
|
||||||
* Jared Weakly
|
`src/fig` and `src/content` are licensed under [Creative Commons
|
||||||
* Paolo G. Giarrusso
|
Attribution-ShareAlike 4.0 International License][license cc by sa].
|
||||||
* Adi Shavit
|
|
||||||
* Mico Loretan
|
|
||||||
* Marcello Seri
|
|
||||||
* Erwin Maruli Tua Pakpahan
|
|
||||||
* Markus Hauck
|
|
||||||
* Yevheniy Zelenskyy
|
|
||||||
* Ross Kirsling
|
|
||||||
* ...and many others!
|
|
||||||
|
|
||||||
The original blog post acknowledgments by Bartosz are consolidated in the *Acknowledgments* page at the end of the book.
|
The script files `scraper.py` and others are licensed under [GNU General Public
|
||||||
|
License version 3][license gnu gpl].
|
||||||
|
|
||||||
**Note from Bartosz**: I really appreciate all your contributions. You made this book much better than I could have imagined. Thank you!
|
[download badge]:
|
||||||
|
https://img.shields.io/badge/Download-latest-green.svg?style=flat-square
|
||||||
License
|
[github actions link]: https://github.com/hmemcpy/milewski-ctfp-pdf/actions
|
||||||
-------
|
[github stars]:
|
||||||
|
https://img.shields.io/github/stars/hmemcpy/milewski-ctfp-pdf.svg?style=flat-square
|
||||||
The PDF book, `.tex` files, and associated images and figures in directories `src/fig` and `src/content` are licensed under Creative Commons Attribution-ShareAlike 4.0 International License ([cc by-sa](http://creativecommons.org/licenses/by-sa/4.0/)).
|
[github workflow status]:
|
||||||
|
https://img.shields.io/github/actions/workflow/status/hmemcpy/milewski-ctfp-pdf/build.yml?branch=master&style=flat-square
|
||||||
The script files `scraper.py` and others are licensed under GNU General Public License version 3 (for details, see [LICENSE](https://github.com/hmemcpy/milewski-ctfp-pdf/blob/master/LICENSE)).
|
[github latest release]:
|
||||||
|
https://github.com/hmemcpy/milewski-ctfp-pdf/releases/latest
|
||||||
|
[license badge]:
|
||||||
|
https://img.shields.io/badge/License-CC_By_SA-green.svg?style=flat-square
|
||||||
|
[ctfp image]:
|
||||||
|
https://user-images.githubusercontent.com/601206/47271389-8eea0900-d581-11e8-8e81-5b932e336336.png
|
||||||
|
[bartosz github]: https://github.com/BartoszMilewski
|
||||||
|
[nixos wiki flake]: https://nixos.wiki/wiki/Flakes
|
||||||
|
[andres raba github]: https://github.com/sarabander
|
||||||
|
[contributors]: https://github.com/hmemcpy/milewski-ctfp-pdf/graphs/contributors
|
||||||
|
[license cc by sa]: https://spdx.org/licenses/CC-BY-SA-4.0.html
|
||||||
|
[license gnu gpl]: https://spdx.org/licenses/GPL-3.0.html
|
||||||
|
[blogpost series]:
|
||||||
|
https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
|
||||||
|
[buy regular edition on blurb]:
|
||||||
|
https://www.blurb.com/b/9621951-category-theory-for-programmers-new-edition-hardco
|
||||||
|
[buy scala edition on blurb]:
|
||||||
|
https://www.blurb.com/b/9603882-category-theory-for-programmers-scala-edition-pape
|
||||||
|
[v1.3.0 github release link]:
|
||||||
|
https://github.com/hmemcpy/milewski-ctfp-pdf/releases/tag/v1.3.0
|
||||||
|
[nix website]: https://nixos.org/nix/
|
||||||
|
[nix download website]: https://nixos.org/download.html
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
let
|
|
||||||
rev = "cecfd08d13ddef8a79f277e67b8084bd9afa1586";
|
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
|
|
||||||
flake = import (fetchTarball url) { src = ./.; };
|
|
||||||
inNixShell = builtins.getEnv "IN_NIX_SHELL" != "";
|
|
||||||
in if inNixShell then flake.shellNix else flake.defaultNix
|
|
@ -2,82 +2,111 @@
|
|||||||
|
|
||||||
### Preface
|
### Preface
|
||||||
|
|
||||||
* [#155](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/155) - Typo (physicist -> physicists)
|
- [#155](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/155) - Typo
|
||||||
|
(physicist -> physicists)
|
||||||
|
|
||||||
### 6. Simple Algebraic Data Types
|
### 6. Simple Algebraic Data Types
|
||||||
|
|
||||||
* [#176](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/176) - Typo (statements -> statement)
|
- [#176](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/176) - Typo
|
||||||
|
(statements -> statement)
|
||||||
|
|
||||||
### 8. Functoriality
|
### 8. Functoriality
|
||||||
|
|
||||||
* [9a3a5a3](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/9a3a5a386e98ef8f926bccd08f572cc19b1a6367) - added clarifications on bifunctoriality vs. separate functoriality (fix by Bartosz)
|
- [9a3a5a3](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/9a3a5a386e98ef8f926bccd08f572cc19b1a6367) -
|
||||||
|
added clarifications on bifunctoriality vs. separate functoriality (fix by
|
||||||
|
Bartosz)
|
||||||
|
|
||||||
### 9. Function Types
|
### 9. Function Types
|
||||||
|
|
||||||
* [#182](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/182) - Fix typo (chose -> choose)
|
- [#182](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/182) - Fix typo
|
||||||
|
(chose -> choose)
|
||||||
|
|
||||||
### 10. Natural Transformations
|
### 10. Natural Transformations
|
||||||
|
|
||||||
* [#157](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/157) - Adding paragraph indent
|
- [#157](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/157) - Adding
|
||||||
|
paragraph indent
|
||||||
|
|
||||||
### 12. Limits and Colimits
|
### 12. Limits and Colimits
|
||||||
|
|
||||||
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
|
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
|
||||||
|
grammatical error
|
||||||
|
|
||||||
### 14. Representable Functors
|
### 14. Representable Functors
|
||||||
|
|
||||||
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
|
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
|
||||||
|
grammatical error
|
||||||
|
|
||||||
### 18. Adjunctions
|
### 18. Adjunctions
|
||||||
|
|
||||||
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "counit"
|
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
|
||||||
|
of "counit"
|
||||||
|
|
||||||
### 19. Free/Forgetful Adjunctions
|
### 19. Free/Forgetful Adjunctions
|
||||||
|
|
||||||
* [#156](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/156) - an instance of the category name **Mon** is appearing as **arg**
|
- [#156](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/156) - an instance of
|
||||||
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "isomorphism"
|
the category name **Mon** is appearing as **arg**
|
||||||
|
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
|
||||||
|
of "isomorphism"
|
||||||
|
|
||||||
### 20. Monads - Programmer's Definition
|
### 20. Monads - Programmer's Definition
|
||||||
|
|
||||||
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix grammatical error
|
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix
|
||||||
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
|
grammatical error
|
||||||
|
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
|
||||||
|
grammatical error
|
||||||
|
|
||||||
### 22. Monads Categorically
|
### 22. Monads Categorically
|
||||||
|
|
||||||
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
|
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
|
||||||
|
grammatical error
|
||||||
|
|
||||||
### 23. Comonads
|
### 23. Comonads
|
||||||
|
|
||||||
* [#158](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/158) - fixed incorrect typesetting of `set`
|
- [#158](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/158) - fixed
|
||||||
* [23f522e](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/23f522ec083c2c98f28f15935ff2893ccd1fa76c) - adjusted `Prod`/`Product` names (fix by Bartosz)
|
incorrect typesetting of `set`
|
||||||
|
- [23f522e](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/23f522ec083c2c98f28f15935ff2893ccd1fa76c) -
|
||||||
|
adjusted `Prod`/`Product` names (fix by Bartosz)
|
||||||
|
|
||||||
### 25. Algebras for Monads
|
### 25. Algebras for Monads
|
||||||
|
|
||||||
* [#158](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/158) - fixed incorrect typesetting of `set`
|
- [#158](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/158) - fixed
|
||||||
* [#159](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/159) - fixed incorrect typesetting of category terms
|
incorrect typesetting of `set`
|
||||||
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "counit" and "morphisms", fix subscript spacing
|
- [#159](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/159) - fixed
|
||||||
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical errors
|
incorrect typesetting of category terms
|
||||||
|
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
|
||||||
|
of "counit" and "morphisms", fix subscript spacing
|
||||||
|
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
|
||||||
|
grammatical errors
|
||||||
|
|
||||||
### 26. Ends and Coends
|
### 26. Ends and Coends
|
||||||
|
|
||||||
* [#159](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/159) - fixed incorrect typesetting of category terms
|
- [#159](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/159) - fixed
|
||||||
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "coequalizer", fix subscript spacing
|
incorrect typesetting of category terms
|
||||||
|
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
|
||||||
|
of "coequalizer", fix subscript spacing
|
||||||
|
|
||||||
### 27. Kan Extensions
|
### 27. Kan Extensions
|
||||||
|
|
||||||
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix subscript spacing
|
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix subscript
|
||||||
* [31821e5](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/31821e5ded0dacf059e1fcb985be406e8a495107) - postcomposition -> precomposition (fix by Bartosz)
|
spacing
|
||||||
|
- [31821e5](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/31821e5ded0dacf059e1fcb985be406e8a495107) -
|
||||||
|
postcomposition -> precomposition (fix by Bartosz)
|
||||||
|
|
||||||
### 28. Enriched Categories
|
### 28. Enriched Categories
|
||||||
|
|
||||||
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix subscript spacing
|
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix subscript
|
||||||
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
|
spacing
|
||||||
|
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
|
||||||
|
grammatical error
|
||||||
|
|
||||||
### 29. Topoi
|
### 29. Topoi
|
||||||
|
|
||||||
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical error
|
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
|
||||||
|
grammatical error
|
||||||
|
|
||||||
### 30. Lawvere Theories
|
### 30. Lawvere Theories
|
||||||
|
|
||||||
* [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling of "coequalizer"
|
- [#160](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/160) - Fix spelling
|
||||||
* [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix grammatical errors and a typesetting error
|
of "coequalizer"
|
||||||
|
- [#162](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/162) - Fix
|
||||||
|
grammatical errors and a typesetting error
|
||||||
|
@ -1,17 +1,27 @@
|
|||||||
## A list of typos/mistakes that were fixed after the release of the new edition (1.3.0) (12 August, 2019).
|
## A list of typos/mistakes that were fixed after the release of the new edition (1.3.0) (12 August, 2019).
|
||||||
(see errata for the original edition until 1.3.0 [here](https://github.com/hmemcpy/milewski-ctfp-pdf/blob/master/errata-1.0.0.md))
|
|
||||||
|
(see errata for the original edition until 1.3.0
|
||||||
|
[here](https://github.com/hmemcpy/milewski-ctfp-pdf/blob/master/errata-1.0.0.md))
|
||||||
|
|
||||||
### Preface
|
### Preface
|
||||||
|
|
||||||
* [#278](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/278) - Fixed reference to Saunders Mac Lane's *Categories for the Working Mathematician*. Was previously misreferenced as "*Category Theory* for the Working Mathematician."
|
- [#278](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/278) - Fixed
|
||||||
|
reference to Saunders Mac Lane's _Categories for the Working Mathematician_.
|
||||||
|
Was previously misreferenced as "_Category Theory_ for the Working
|
||||||
|
Mathematician."
|
||||||
|
|
||||||
### 12. Limits and Colimits
|
### 12. Limits and Colimits
|
||||||
|
|
||||||
* [#278](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/278) - Fixed formatting of quotation marks around "selecting." Were previously pointing the wrong direction.
|
- [#278](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/278) - Fixed
|
||||||
|
formatting of quotation marks around "selecting." Were previously pointing the
|
||||||
|
wrong direction.
|
||||||
|
|
||||||
### 18. Adjunctions
|
### 18. Adjunctions
|
||||||
|
|
||||||
* [#228](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/228) - Typo (adjuncion -> adjunction)
|
- [#228](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/228) - Typo
|
||||||
|
(adjuncion -> adjunction)
|
||||||
|
|
||||||
### 30. Lawvere Theories
|
### 30. Lawvere Theories
|
||||||
|
|
||||||
* [#226](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/226) - fix type in diagram of monads as coends
|
- [#226](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/226) - fix type in
|
||||||
|
diagram of monads as coends
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
### 7. Functors
|
### 7. Functors
|
||||||
|
|
||||||
* [3d29cd9](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/3d29cd99f34ce1205ed9a68aeae038d9d47c7145) - Added `LazyList` example, supported since Scala 2.13
|
- [3d29cd9](https://github.com/hmemcpy/milewski-ctfp-pdf/commit/3d29cd99f34ce1205ed9a68aeae038d9d47c7145) -
|
||||||
|
Added `LazyList` example, supported since Scala 2.13
|
||||||
|
|
||||||
* [#210](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/210) - Section 6.4 - `prodToSum` snippet. Explicitly Tupling return type to avoid adapted args warning, which is deprecated behavior
|
- [#210](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/210) - Section 6.4 -
|
||||||
|
`prodToSum` snippet. Explicitly Tupling return type to avoid adapted args
|
||||||
|
warning, which is deprecated behavior
|
||||||
|
|
||||||
* [#243](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/243) - Section 8.7 - Change bimap to dimap in Profunctor definition
|
- [#243](https://github.com/hmemcpy/milewski-ctfp-pdf/pull/243) - Section 8.7 -
|
||||||
|
Change bimap to dimap in Profunctor definition
|
||||||
|
62
flake.lock
62
flake.lock
@ -1,40 +1,60 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1674771137,
|
||||||
|
"narHash": "sha256-Zpk1GbEsYrqKmuIZkx+f+8pU0qcCYJoSUwNz1Zk+R00=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "7c7a8bce3dffe71203dcd4276504d1cb49dfe05f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "flake-parts",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1645379616,
|
"lastModified": 1675153841,
|
||||||
"narHash": "sha256-eLzR3MRS9hcNqSWZxP6BP7xiBjgC3/pB5n2Q0lLFe/g=",
|
"narHash": "sha256-EWvU3DLq+4dbJiukfhS7r6sWZyJikgXn6kNl7eHljW8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "40ef692a55b188b1f5ae3967f3fc7808838c3f1d",
|
"rev": "ea692c2ad1afd6384e171eabef4f0887d2b882d3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-21.11",
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-lib": {
|
||||||
|
"locked": {
|
||||||
|
"dir": "lib",
|
||||||
|
"lastModified": 1672350804,
|
||||||
|
"narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"dir": "lib",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs",
|
"flake-parts": "flake-parts",
|
||||||
"utils": "utils"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
|
||||||
},
|
|
||||||
"utils": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1644229661,
|
|
||||||
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
196
flake.nix
196
flake.nix
@ -1,75 +1,124 @@
|
|||||||
{
|
{
|
||||||
description = "Category Theory for Programmers";
|
description = "Category Theory for Programmers";
|
||||||
|
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
inputs.utils.url = "github:numtide/flake-utils";
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: let
|
outputs = inputs @ {
|
||||||
|
self,
|
||||||
|
flake-parts,
|
||||||
|
nixpkgs,
|
||||||
|
}:
|
||||||
|
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
perSystem = {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# LaTeX font
|
||||||
|
inconsolata-lgc-latex = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
name = "inconsolata-lgc-latex";
|
||||||
|
pname = "inconsolata-lgc-latex";
|
||||||
|
|
||||||
|
src = pkgs.inconsolata-lgc;
|
||||||
|
|
||||||
|
dontConfigure = true;
|
||||||
|
sourceRoot = ".";
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
find $src -name '*.ttf' -exec install -m644 -Dt $out/fonts/truetype/public/inconsolata-lgc/ {} \;
|
||||||
|
find $src -name '*.otf' -exec install -m644 -Dt $out/fonts/opentype/public/inconsolata-lgc/ {} \;
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
tlType = "run";
|
||||||
|
};
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# LaTeX Environment
|
# LaTeX Environment
|
||||||
texliveEnv = pkgs.texlive.combine {
|
texliveEnv = pkgs.texlive.combine {
|
||||||
inherit (pkgs.texlive)
|
inherit
|
||||||
bookcover
|
(pkgs.texlive)
|
||||||
textpos
|
|
||||||
fgruler
|
|
||||||
tcolorbox
|
|
||||||
fvextra
|
|
||||||
framed
|
|
||||||
newtx
|
|
||||||
nowidow
|
|
||||||
emptypage
|
|
||||||
wrapfig
|
|
||||||
subfigure
|
|
||||||
adjustbox
|
adjustbox
|
||||||
collectbox
|
alegreya
|
||||||
tikz-cd
|
|
||||||
imakeidx
|
|
||||||
idxlayout
|
|
||||||
titlesec
|
|
||||||
subfiles
|
|
||||||
lettrine
|
|
||||||
upquote
|
|
||||||
libertine
|
|
||||||
mweights
|
|
||||||
fontaxes
|
|
||||||
mdframed
|
|
||||||
needspace
|
|
||||||
xifthen
|
|
||||||
ifnextok
|
|
||||||
currfile
|
|
||||||
noindentafter
|
|
||||||
ifmtarg
|
|
||||||
scheme-medium
|
|
||||||
listings
|
|
||||||
minted
|
|
||||||
microtype
|
|
||||||
babel
|
babel
|
||||||
todonotes
|
bookcover
|
||||||
|
catchfile
|
||||||
chngcntr
|
chngcntr
|
||||||
ifplatform
|
collectbox
|
||||||
xstring
|
currfile
|
||||||
minifp
|
emptypage
|
||||||
titlecaps
|
|
||||||
enumitem
|
enumitem
|
||||||
environ
|
environ
|
||||||
trimspaces
|
fgruler
|
||||||
l3packages
|
fontaxes
|
||||||
zref
|
framed
|
||||||
catchfile
|
fvextra
|
||||||
|
idxlayout
|
||||||
|
ifmtarg
|
||||||
|
ifnextok
|
||||||
|
ifplatform
|
||||||
|
imakeidx
|
||||||
import
|
import
|
||||||
|
inconsolata
|
||||||
|
l3packages
|
||||||
|
lettrine
|
||||||
|
libertine
|
||||||
|
libertinus-fonts
|
||||||
|
listings
|
||||||
|
mdframed
|
||||||
|
microtype
|
||||||
|
minifp
|
||||||
|
minted
|
||||||
|
mweights
|
||||||
|
needspace
|
||||||
|
newtx
|
||||||
|
noindentafter
|
||||||
|
nowidow
|
||||||
|
scheme-medium
|
||||||
|
subfigure
|
||||||
|
subfiles
|
||||||
|
textpos
|
||||||
|
tcolorbox
|
||||||
|
tikz-cd
|
||||||
|
titlecaps
|
||||||
|
titlesec
|
||||||
|
todonotes
|
||||||
|
trimspaces
|
||||||
|
upquote
|
||||||
|
wrapfig
|
||||||
|
xifthen
|
||||||
|
xpatch
|
||||||
|
xstring
|
||||||
|
zref
|
||||||
;
|
;
|
||||||
|
|
||||||
|
inconsolata-lgc-latex = {
|
||||||
|
pkgs = [inconsolata-lgc-latex];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# Python Environment
|
# Python Environment
|
||||||
|
|
||||||
# Pin the Python version and its associated package set in a single place.
|
# Pin the Python version and its associated package set in a single place.
|
||||||
python = pkgs.python38;
|
python = pkgs.python311;
|
||||||
pythonPkgs = pkgs.python38Packages;
|
pythonPkgs = pkgs.python311Packages;
|
||||||
|
|
||||||
pygments-style-github = pythonPkgs.buildPythonPackage rec {
|
pygments-style-github = pythonPkgs.buildPythonPackage rec {
|
||||||
pname = "pygments-style-github";
|
pname = "pygments-style-github";
|
||||||
@ -91,32 +140,34 @@
|
|||||||
|
|
||||||
commonAttrs = {
|
commonAttrs = {
|
||||||
nativeBuildInputs = [texliveEnv pythonEnv pkgs.which];
|
nativeBuildInputs = [texliveEnv pythonEnv pkgs.which];
|
||||||
FONTCONFIG_FILE = pkgs.makeFontsConf {
|
|
||||||
fontDirectories = with pkgs; [ inconsolata-lgc libertine libertinus ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mkLatex = variant: edition: let
|
mkLatex = variant: edition: let
|
||||||
maybeVariant = lib.optionalString (variant != null) "-${variant}";
|
maybeVariant = lib.optionalString (variant != null) "-${variant}";
|
||||||
maybeEdition = lib.optionalString (edition != null) "-${edition}";
|
maybeEdition = lib.optionalString (edition != null) "-${edition}";
|
||||||
variantStr = if variant == null then "reader" else variant;
|
variantStr =
|
||||||
|
if variant == null
|
||||||
|
then "reader"
|
||||||
|
else variant;
|
||||||
suffix = maybeVariant + maybeEdition;
|
suffix = maybeVariant + maybeEdition;
|
||||||
basename = "ctfp-${variantStr}${maybeEdition}";
|
basename = "ctfp-${variantStr}${maybeEdition}";
|
||||||
version = self.shortRev or self.lastModifiedDate;
|
version = self.shortRev or self.lastModifiedDate;
|
||||||
in pkgs.stdenv.mkDerivation (commonAttrs // {
|
in
|
||||||
|
pkgs.stdenv.mkDerivation (commonAttrs
|
||||||
|
// {
|
||||||
inherit basename version;
|
inherit basename version;
|
||||||
|
|
||||||
name = "ctfp${suffix}-${version}";
|
name = "ctfp${suffix}";
|
||||||
fullname = "ctfp${suffix}";
|
fullname = "ctfp${suffix}";
|
||||||
src = "${self}/src";
|
src = "${self}/src";
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
echo -n "\\newcommand{\\OPTversion}{$version}" > version.tex
|
substituteInPlace "version.tex" --replace "dev" "${version}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
latexmk -shell-escape -interaction=nonstopmode -halt-on-error \
|
latexmk -file-line-error -shell-escape -logfilewarninglist -interaction=nonstopmode -halt-on-error \
|
||||||
-norc -jobname=ctfp -pdflatex="xelatex %O %S" -pdf "$basename.tex"
|
-norc -jobname=ctfp -pdflatex="xelatex %O %S" -pdfxe "$basename.tex"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = "install -m 0644 -vD ctfp.pdf \"$out/$fullname.pdf\"";
|
installPhase = "install -m 0644 -vD ctfp.pdf \"$out/$fullname.pdf\"";
|
||||||
@ -126,24 +177,27 @@
|
|||||||
|
|
||||||
editions = [null "scala" "ocaml" "reason"];
|
editions = [null "scala" "ocaml" "reason"];
|
||||||
variants = [null "print"];
|
variants = [null "print"];
|
||||||
in {
|
in rec {
|
||||||
# nix build .#ctfp
|
formatter = pkgs.alejandra;
|
||||||
# nix build .#ctfp-print
|
|
||||||
# nix build .#ctfp-print-ocaml
|
packages = lib.listToAttrs (lib.concatMap (variant:
|
||||||
# etc etc
|
map (edition: rec {
|
||||||
packages = lib.listToAttrs (lib.concatMap (variant: map (edition: rec {
|
|
||||||
name = value.packageName;
|
name = value.packageName;
|
||||||
value = mkLatex variant edition;
|
value = mkLatex variant edition;
|
||||||
}) editions) variants);
|
})
|
||||||
|
editions)
|
||||||
# nix build .
|
variants);
|
||||||
defaultPackage = self.packages.${system}.ctfp;
|
|
||||||
|
|
||||||
# nix develop .
|
# nix develop .
|
||||||
devShell = pkgs.mkShell (commonAttrs // {
|
devShells.default = pkgs.mkShellNoCC (commonAttrs
|
||||||
nativeBuildInputs = commonAttrs.nativeBuildInputs ++ [
|
// {
|
||||||
pkgs.git pkgs.gnumake
|
nativeBuildInputs =
|
||||||
|
commonAttrs.nativeBuildInputs
|
||||||
|
++ [
|
||||||
|
pkgs.git
|
||||||
|
pkgs.gnumake
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
12
shell.nix
12
shell.nix
@ -1,12 +0,0 @@
|
|||||||
(import
|
|
||||||
(
|
|
||||||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
|
||||||
fetchTarball {
|
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
|
||||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
{
|
|
||||||
src = ./.;
|
|
||||||
}
|
|
||||||
).shellNix
|
|
17
src/.gitignore
vendored
17
src/.gitignore
vendored
@ -1,17 +0,0 @@
|
|||||||
*.aux
|
|
||||||
*.cp*
|
|
||||||
*.fn
|
|
||||||
*.ky
|
|
||||||
*.log
|
|
||||||
*.pg
|
|
||||||
*.toc
|
|
||||||
*.tp
|
|
||||||
*.vr
|
|
||||||
*.vim
|
|
||||||
*.idx
|
|
||||||
*.ilg
|
|
||||||
*.ind
|
|
||||||
*.out
|
|
||||||
*.swp
|
|
||||||
*~
|
|
||||||
ctfp.fdb_latexmk
|
|
85
src/Makefile
85
src/Makefile
@ -1,85 +0,0 @@
|
|||||||
# Igal Tabachnik, 2007.
|
|
||||||
# Based on work by Andres Raba et al., 2013-2015.
|
|
||||||
|
|
||||||
.PHONY: default all clean out-dir version.tex scala ocaml reason
|
|
||||||
|
|
||||||
DIR := $(shell pwd)
|
|
||||||
GIT_VER := $(shell git describe --tags --always --long | tr -d '\n')
|
|
||||||
OUTPUT_DIR := ../out
|
|
||||||
|
|
||||||
OUTPUT = category-theory-for-programmers
|
|
||||||
|
|
||||||
# Default top-level LaTeX to generate
|
|
||||||
DEFAULTTOPTEX = ctfp-reader.tex ctfp-print.tex
|
|
||||||
|
|
||||||
SCALATEXFILES = ctfp-reader-scala.tex ctfp-print-scala.tex # todo make this a macro
|
|
||||||
|
|
||||||
OCAMLTEXFILES = ctfp-reader-ocaml.tex ctfp-print-ocaml.tex # todo make this a macro
|
|
||||||
|
|
||||||
REASONTEXFILES = ctfp-reader-reason.tex ctfp-print-reason.tex # todo make this a macro
|
|
||||||
|
|
||||||
# Top-level LaTeX files from which CTFP book can be generated
|
|
||||||
TOPTEXFILES = version.tex $(DEFAULTTOPTEX) $(SCALATEXFILES) $(OCAMLTEXFILES) $(REASONTEXFILES)
|
|
||||||
|
|
||||||
# Default PDF file to make
|
|
||||||
DEFAULTPDF:=$(DEFAULTTOPTEX:.tex=.pdf)
|
|
||||||
|
|
||||||
# Scala PDF file to make
|
|
||||||
SCALAPDF:=$(SCALATEXFILES:.tex=.pdf)
|
|
||||||
|
|
||||||
# OCaml PDF file to make
|
|
||||||
OCAMLPDF:=$(OCAMLTEXFILES:.tex=.pdf)
|
|
||||||
|
|
||||||
# ReasonML PDF file to make
|
|
||||||
REASONPDF:=$(REASONTEXFILES:.tex=.pdf)
|
|
||||||
|
|
||||||
# Other PDF files for the CTFP book
|
|
||||||
TOPPDFFILES:=$(TOPTEXFILES:.tex=.pdf)
|
|
||||||
|
|
||||||
# Configuration files
|
|
||||||
OPTFILES = opt-print-ustrade.tex \
|
|
||||||
opt-reader-10in.tex \
|
|
||||||
opt-scala.tex
|
|
||||||
|
|
||||||
# All the LaTeX files for the CTFP book in order of dependency
|
|
||||||
TEXFILES = $(TOPTEXFILES) $(SCALATEXFILES) $(OCAMLTEXFILES) $(REASONTEXFILES) $(OPTFILES)
|
|
||||||
|
|
||||||
default: suffix=''
|
|
||||||
default: out-dir $(DEFAULTPDF) # todo cover
|
|
||||||
|
|
||||||
all: clean default scala ocaml reason
|
|
||||||
|
|
||||||
scala: suffix='-scala'
|
|
||||||
scala: clean out-dir version.tex $(SCALAPDF)
|
|
||||||
|
|
||||||
ocaml: suffix='-ocaml'
|
|
||||||
ocaml: clean out-dir version.tex $(OCAMLPDF)
|
|
||||||
|
|
||||||
reason: suffix='-reason'
|
|
||||||
reason: clean out-dir version.tex $(REASONPDF)
|
|
||||||
|
|
||||||
# Main targets
|
|
||||||
$(TOPPDFFILES) : %.pdf : %.tex $(TEXFILES)
|
|
||||||
if which latexmk > /dev/null 2>&1 ;\
|
|
||||||
then \
|
|
||||||
latexmk -shell-escape -interaction=nonstopmode -halt-on-error -norc -jobname=ctfp -pdflatex="xelatex %O %S" -pdf $< ;\
|
|
||||||
mv ctfp.pdf $(OUTPUT_DIR)/$(subst ctfp,$(OUTPUT),$(subst ctfp-reader,$(OUTPUT),$*)).pdf ;\
|
|
||||||
else @printf "Error: unable to find latexmk. Is it installed?\n" ;\
|
|
||||||
fi
|
|
||||||
|
|
||||||
version.tex:
|
|
||||||
@printf '\\newcommand{\\OPTversion}{' > version.tex
|
|
||||||
@printf $(GIT_VER) >> version.tex
|
|
||||||
@printf '}' >> version.tex
|
|
||||||
|
|
||||||
out-dir:
|
|
||||||
@printf 'Creating output directory: $(OUTPUT_DIR)\n'
|
|
||||||
mkdir -p $(OUTPUT_DIR)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *~ *.aux {ctfp-*}.{out,log,pdf,dvi,fls,fdb_latexmk,aux,brf,bbl,idx,ilg,ind,toc,sed}
|
|
||||||
if which latexmk > /dev/null 2>&1 ; then latexmk -CA; fi
|
|
||||||
rm -rf ../out
|
|
||||||
|
|
||||||
clean-minted:
|
|
||||||
rm -rf _minted-*
|
|
@ -13,18 +13,7 @@
|
|||||||
\usetikzlibrary{calc,positioning, shadings}
|
\usetikzlibrary{calc,positioning, shadings}
|
||||||
\usepackage[T1]{fontenc}
|
\usepackage[T1]{fontenc}
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
|
\usepackage{Alegreya}
|
||||||
\setmainfont[
|
|
||||||
Path=fonts/,
|
|
||||||
Extension=.otf,
|
|
||||||
UprightFont=*-Regular,
|
|
||||||
ItalicFont=*-Italic,
|
|
||||||
BoldFont=*-Bold,
|
|
||||||
UprightFeatures={SmallCapsFont=*SC-Regular},
|
|
||||||
ItalicFeatures={SmallCapsFont=*SC-Italic},
|
|
||||||
BoldFeatures={SmallCapsFont=*SC-Bold},
|
|
||||||
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
|
|
||||||
]{AlegreyaSans}
|
|
||||||
|
|
||||||
\newcommand{\olpath}{../}
|
\newcommand{\olpath}{../}
|
||||||
\newcommand{\whitebg}[1]{%
|
\newcommand{\whitebg}[1]{%
|
||||||
|
@ -13,18 +13,7 @@
|
|||||||
\usetikzlibrary{calc,positioning, shadings}
|
\usetikzlibrary{calc,positioning, shadings}
|
||||||
\usepackage[T1]{fontenc}
|
\usepackage[T1]{fontenc}
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
|
\usepackage{Alegreya}
|
||||||
\setmainfont[
|
|
||||||
Path=fonts/,
|
|
||||||
Extension=.otf,
|
|
||||||
UprightFont=*-Regular,
|
|
||||||
ItalicFont=*-Italic,
|
|
||||||
BoldFont=*-Bold,
|
|
||||||
UprightFeatures={SmallCapsFont=*SC-Regular},
|
|
||||||
ItalicFeatures={SmallCapsFont=*SC-Italic},
|
|
||||||
BoldFeatures={SmallCapsFont=*SC-Bold},
|
|
||||||
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
|
|
||||||
]{AlegreyaSans}
|
|
||||||
|
|
||||||
\newcommand{\olpath}{../}
|
\newcommand{\olpath}{../}
|
||||||
\newcommand{\whitebg}[1]{%
|
\newcommand{\whitebg}[1]{%
|
||||||
|
@ -13,18 +13,7 @@
|
|||||||
\usetikzlibrary{calc,positioning, shadings}
|
\usetikzlibrary{calc,positioning, shadings}
|
||||||
\usepackage[T1]{fontenc}
|
\usepackage[T1]{fontenc}
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
|
\usepackage{Alegreya}
|
||||||
\setmainfont[
|
|
||||||
Path=fonts/,
|
|
||||||
Extension=.otf,
|
|
||||||
UprightFont=*-Regular,
|
|
||||||
ItalicFont=*-Italic,
|
|
||||||
BoldFont=*-Bold,
|
|
||||||
UprightFeatures={SmallCapsFont=*SC-Regular},
|
|
||||||
ItalicFeatures={SmallCapsFont=*SC-Italic},
|
|
||||||
BoldFeatures={SmallCapsFont=*SC-Bold},
|
|
||||||
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
|
|
||||||
]{AlegreyaSans}
|
|
||||||
|
|
||||||
\newcommand{\olpath}{../}
|
\newcommand{\olpath}{../}
|
||||||
\newcommand{\whitebg}[1]{%
|
\newcommand{\whitebg}[1]{%
|
||||||
|
@ -14,26 +14,7 @@
|
|||||||
\usetikzlibrary{calc,positioning, shadings}
|
\usetikzlibrary{calc,positioning, shadings}
|
||||||
\usepackage[T1]{fontenc}
|
\usepackage[T1]{fontenc}
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
|
\usepackage{Alegreya}
|
||||||
% \setmainfont{AlegreyaSans-Regular}[
|
|
||||||
% BoldFont={AlegreyaSans-Bold},
|
|
||||||
% ItalicFont={AlegreyaSans-Italic},
|
|
||||||
% UprightFeatures={SmallCapsFont=AlegreyaSansSC-Regular},
|
|
||||||
% ItalicFeatures={SmallCapsFont=AlegreyaSansSC-Italic},
|
|
||||||
% BoldFeatures={SmallCapsFont=AlegreyaSansSC-Bold},
|
|
||||||
% BoldItalicFeatures={SmallCapsFont=AlegreyaSansSC-BoldItalic},
|
|
||||||
% ]
|
|
||||||
\setmainfont[
|
|
||||||
Path=fonts/,
|
|
||||||
Extension=.otf,
|
|
||||||
UprightFont=*-Regular,
|
|
||||||
ItalicFont=*-Italic,
|
|
||||||
BoldFont=*-Bold,
|
|
||||||
UprightFeatures={SmallCapsFont=*SC-Regular},
|
|
||||||
ItalicFeatures={SmallCapsFont=*SC-Italic},
|
|
||||||
BoldFeatures={SmallCapsFont=*SC-Bold},
|
|
||||||
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
|
|
||||||
]{AlegreyaSans}
|
|
||||||
|
|
||||||
\newcommand{\olpath}{../}
|
\newcommand{\olpath}{../}
|
||||||
\newcommand{\whitebg}[1]{%
|
\newcommand{\whitebg}[1]{%
|
||||||
|
@ -14,26 +14,7 @@
|
|||||||
\usetikzlibrary{calc,positioning, shadings}
|
\usetikzlibrary{calc,positioning, shadings}
|
||||||
\usepackage[T1]{fontenc}
|
\usepackage[T1]{fontenc}
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
|
\usepackage{Alegreya}
|
||||||
% \setmainfont{AlegreyaSans-Regular}[
|
|
||||||
% BoldFont={AlegreyaSans-Bold},
|
|
||||||
% ItalicFont={AlegreyaSans-Italic},
|
|
||||||
% UprightFeatures={SmallCapsFont=AlegreyaSansSC-Regular},
|
|
||||||
% ItalicFeatures={SmallCapsFont=AlegreyaSansSC-Italic},
|
|
||||||
% BoldFeatures={SmallCapsFont=AlegreyaSansSC-Bold},
|
|
||||||
% BoldItalicFeatures={SmallCapsFont=AlegreyaSansSC-BoldItalic},
|
|
||||||
% ]
|
|
||||||
\setmainfont[
|
|
||||||
Path=fonts/,
|
|
||||||
Extension=.otf,
|
|
||||||
UprightFont=*-Regular,
|
|
||||||
ItalicFont=*-Italic,
|
|
||||||
BoldFont=*-Bold,
|
|
||||||
UprightFeatures={SmallCapsFont=*SC-Regular},
|
|
||||||
ItalicFeatures={SmallCapsFont=*SC-Italic},
|
|
||||||
BoldFeatures={SmallCapsFont=*SC-Bold},
|
|
||||||
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
|
|
||||||
]{AlegreyaSans}
|
|
||||||
|
|
||||||
\newcommand{\olpath}{../}
|
\newcommand{\olpath}{../}
|
||||||
\newcommand{\whitebg}[1]{%
|
\newcommand{\whitebg}[1]{%
|
||||||
|
@ -14,18 +14,7 @@
|
|||||||
\usetikzlibrary{calc,positioning, shadings}
|
\usetikzlibrary{calc,positioning, shadings}
|
||||||
\usepackage[T1]{fontenc}
|
\usepackage[T1]{fontenc}
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
|
\usepackage{Alegreya}
|
||||||
\setmainfont[
|
|
||||||
Path=fonts/,
|
|
||||||
Extension=.otf,
|
|
||||||
UprightFont=*-Regular,
|
|
||||||
ItalicFont=*-Italic,
|
|
||||||
BoldFont=*-Bold,
|
|
||||||
UprightFeatures={SmallCapsFont=*SC-Regular},
|
|
||||||
ItalicFeatures={SmallCapsFont=*SC-Italic},
|
|
||||||
BoldFeatures={SmallCapsFont=*SC-Bold},
|
|
||||||
BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
|
|
||||||
]{AlegreyaSans}
|
|
||||||
|
|
||||||
\newcommand{\olpath}{../}
|
\newcommand{\olpath}{../}
|
||||||
\newcommand{\whitebg}[1]{%
|
\newcommand{\whitebg}[1]{%
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -23,7 +23,7 @@
|
|||||||
\defaultfontfeatures{% % is important for
|
\defaultfontfeatures{% % is important for
|
||||||
Scale=MatchLowercase, % needed here ... % single quotes not
|
Scale=MatchLowercase, % needed here ... % single quotes not
|
||||||
} % to turn out curly
|
} % to turn out curly
|
||||||
\setmonofont[Path=fonts/, BoldFont=Inconsolata-LGC-Bold.ttf]{Inconsolata-LGC-Bold.ttf} % ("typographic")
|
\setmonofont[BoldFont=Inconsolata-LGC-Bold.ttf]{Inconsolata-LGC-Bold.ttf} % ("typographic")
|
||||||
% in verbatim blocks
|
% in verbatim blocks
|
||||||
\defaultfontfeatures{% % of Haskell code.
|
\defaultfontfeatures{% % of Haskell code.
|
||||||
Scale=MatchLowercase, % ... and here again % Now the quote is
|
Scale=MatchLowercase, % ... and here again % Now the quote is
|
||||||
@ -43,7 +43,7 @@
|
|||||||
\expandafter\let\csname not<\endcsname\relax
|
\expandafter\let\csname not<\endcsname\relax
|
||||||
\expandafter\let\csname not>\endcsname\relax
|
\expandafter\let\csname not>\endcsname\relax
|
||||||
\usepackage{unicode-math}
|
\usepackage{unicode-math}
|
||||||
\setmathfont[Path=fonts/]{LibertinusMath-Regular.otf}
|
\setmathfont{LibertinusMath-Regular.otf}
|
||||||
|
|
||||||
\usepackage[all]{nowidow}
|
\usepackage[all]{nowidow}
|
||||||
\usepackage{emptypage}
|
\usepackage{emptypage}
|
||||||
@ -170,6 +170,16 @@
|
|||||||
{\end{Verbatim}\end{mdframed}
|
{\end{Verbatim}\end{mdframed}
|
||||||
\vspace{-1ex}}
|
\vspace{-1ex}}
|
||||||
|
|
||||||
|
% See the context about this workaround at
|
||||||
|
% https://github.com/gpoore/minted/issues/354
|
||||||
|
\makeatletter
|
||||||
|
\ifwindows
|
||||||
|
\def\minted@opt@quote#1{\detokenize\expandafter{\expandafter"\expanded{#1}"}}
|
||||||
|
\else
|
||||||
|
\def\minted@opt@quote#1{\detokenize\expandafter{\expandafter'\expanded{#1}'}}
|
||||||
|
\fi
|
||||||
|
\makeatother
|
||||||
|
|
||||||
\NewDocumentCommand\src{mO{}}{
|
\NewDocumentCommand\src{mO{}}{
|
||||||
\srcsnippet{\currfileabsdir/code/haskell/#1.hs}{blue}{haskell}{#2}
|
\srcsnippet{\currfileabsdir/code/haskell/#1.hs}{blue}{haskell}{#2}
|
||||||
\ifdefined\OPTCustomLanguage{%
|
\ifdefined\OPTCustomLanguage{%
|
||||||
|
1
src/version.tex
Normal file
1
src/version.tex
Normal file
@ -0,0 +1 @@
|
|||||||
|
\newcommand\OPTversion{dev}
|
Loading…
Reference in New Issue
Block a user