write-you-a-haskell/contributing.md
Stephen Diehl 73b43dcf89 Squashed commit of the following:
commit 41ba8c36a90cc11723b14ce6c45599eabdcfaa53
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 21:02:57 2015 -0500

    type provenance

commit be5eda941bb4c44b4c4af0ddbbd793643938f4ff
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 20:13:06 2015 -0500

    provenance prototype

commit 7aa958b9c279e7571f7c4887f6aa19443e16f6fb
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 19:35:08 2015 -0500

    fix misc typos

commit 52d60b3b2630e50ef0cd6ea5f0fa1f308d92e26d
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 15:15:58 2015 -0500

    license badge

commit 7d34274afe6f05a0002c8f87e5077b6a130b42b4
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 15:07:28 2015 -0500

    fix resolution for llvm cfg graphs

commit 14d9bc836ecc64f8e9acc60bcbd2da02335255b9
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 13:12:39 2015 -0500

    added codegen dsl stub

commit 0f74cdd6f95d0a1fe1cafd73e45cb1407709efd8
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 13:01:14 2015 -0500

    llvm cfg graphs

commit a199d721503985954060e7670c1d2f5e1a65dd11
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 10:56:54 2015 -0500

    source code font

commit c7db0c5d67b73d8633f08be093971877e2d6ede0
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sun Jan 18 09:59:37 2015 -0500

    change phrasing around recursion

commit 6903700db482524233262e722df54b1066218250
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sat Jan 17 18:20:06 2015 -0500

    contributors.md

commit 14d90a3f2ebf7ddf1229c084fe4a1e9fa13f2e41
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sat Jan 17 17:35:41 2015 -0500

    added llvm logo

commit d270df6d94cbf1ef9eddfdd64af5aabc36ebca72
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sat Jan 17 15:50:28 2015 -0500

    initial llvm chapter

commit e71b189c057ea9e399e90e47d9d49bb4cf12cda8
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Sat Jan 17 12:21:00 2015 -0500

    system-f typing rules

commit 2a7d5c7f137cf352eeae64836df634c98118f594
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Thu Jan 15 15:21:14 2015 -0500

    flesh out system-f

commit 7b3b2f0a2aea5e1102abe093cf5e0559090720aa
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Wed Jan 14 22:22:14 2015 -0500

    started on extended parser

commit cdeaf1a2658f15346fe1dc665ca09e954cce6c2e
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Wed Jan 14 17:25:02 2015 -0500

    creative commons license

commit f09d210be253a05fc8ad0827cd72ffa32404e2ba
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Wed Jan 14 16:54:10 2015 -0500

    higher res images

commit 8555eadfea8843f5683621e6652857e4259fa896
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Wed Jan 14 14:48:44 2015 -0500

    cover page

commit e5e542e92610f4bb4c5ac726ffa86cd1e07753e3
Author: Stephen Diehl <stephen.m.diehl@gmail.com>
Date:   Tue Jan 13 17:31:01 2015 -0500

    initial happy/alex parser
2015-01-18 21:04:01 -05:00

3.7 KiB

Contributing

As always, I rely on the perpetual kindness and goodwill of Haskellers (like you!) to help correct grammar, clarify, and fix errors.

Git Repo

Simple Fixes

For most fixes you can simply edit the Markdown files at the toplevel of the Git repo and then submit a pull request on Github. There should be no need to compile the text locally. I will try to merge the changes quickly and rebuild the text daily.

If you would like to add your name to CONTRIBUTORS.md submit this along with your pull request.

Complex Fixes

If you'd like to submit a change to the publishing software around the text, then clone the repo. You will need a local copy of Pandoc library to use the build system.

$ git clone https://github.com/sdiehl/write-you-a-haskell.git
$ make        # Makes all html files
$ make pdf    # Makes a pdf containing all the chapters

Pandoc

The text is written in the Markdown language and handled with the Pandoc processing library, which is itself written in Haskell!

The tutorial uses a custom pandoc preprocessor contained in includes.hs. This allows us to include and slice fragments of code from files in the src directory.

LaTeX Macros

~~~~ {literal="latex_macros"}
~~~~

Including Whole Source Files

~~~~ {.haskell include="includes.hs"}
~~~~

Including Partial Source Files

Will slice the lines 5-15 inclusively from the file parsec.hs with the Haskell syntax highlighting.

~~~~ {.haskell slice="src/parsers/parsec.hs" lower=5 upper=15}
~~~~

Math Typesetting

Equations can be included in display form:

$$
\int_\Omega \mathrm{d}\omega = \oint_{\partial \Omega} \omega
$$

\int_\Omega \mathrm{d}\omega = \oint_{\partial \Omega} \omega

Or in inline form (like a^2 + b^2 = c^2) with single dollar signs. Specially there must be no spaces around the dollar signs otherwise Pandoc will not parse it properly.

$a^2 + b^2 = c^2$

For most definitions, the aligned block is used:

$$
\begin{aligned}
e :=\ & x            & \text{Var} \\
     & \lambda x. e  & \text{Lam} \\
     & e\ e          & \text{App} \\
\end{aligned}
$$

Will generate:


\begin{aligned}
e :=\ & x            & \text{Var} \\
     & \lambda x. e  & \text{Lam} \\
     & e\ e          & \text{App} \\
\end{aligned}

Several type theory macros are also included on many pages:

$$
\infrule{ 0 : \t{nat}}{\infrule{\t{succ}(0) : \t{nat}}{ \t{succ}(\t{succ}(0)) : \t{nat} }}
$$

Will generate:


\infrule{ 0 : \t{nat}}{\infrule{\t{succ}(0) : \t{nat}}{ \t{succ}(\t{succ}(0)) : \t{nat} }}

Typography

  • Body is the system sans serif default preferring Helvetica Neue Regular or Arial if available.
  • Subtitles are in Signika.
  • Titles are in Helvetica Neue Light.
  • Code is typeset in Inconsolata or Monaco.

LaTeX

The LaTeX styling is sourced from the template.latex file, which is an extension of Pandoc's default template with some custom modifications.

Images

The images are drawn in SVG using Inkscape.

Graphs and blocks diagrams are generated using graphviz.

Preprocessor

The source for the preprocessor is a simple bottom-up traversal replacement of these custom markdown extensions:

Reference Code

The subject of this text is largely build around the mini Haskell compiler. Several other files are included for earlier chapters.

Translations

I am also very keen to the idea of having multiple language translations, if you would like to translate the text into your native language please get in touch.