build environment

This commit is contained in:
Stephen Diehl 2015-11-21 09:52:39 -05:00
parent f23c18bf17
commit 0ecbb87423
6 changed files with 64 additions and 5 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ includes
*.html
*.agdai
*.history
Setup.hs

View File

@ -4,6 +4,25 @@
Datatypes
=========
Algebraic data types
--------------------
**Algebraic datatypes** are a family of constructions arising out of two
operations, sums and products. A product encodes multiple arguments to
constructors and sums encode choice between constructors.
```haskell
data Unit = Unit -- 1
data Empty -- 0
data (a * b) = Product a b -- a * b
data (a + b) = Inl a | Inr b -- a + b
data Exp a b = Exp (a -> b) -- a^b
data Rec f = Rec (f (Rec f)) -- \mu
```
Catamorphisms
-------------
Syntax
------

View File

@ -57,6 +57,20 @@ Releases
* Chapter 27: Row Polymorphism & Effect Typing
* Chapter 28: Future Work
Building
--------
To generate the build scripts provision a cabal sandbox with pandoc in it. This
is done by the ``write-you-a-haskell.cabal`` file.
```bash
$ cabal sandbox init
$ cabal install --only-dependencies
$ cabal exec bash
$ make
$ make pdf
```
Contributing
------------

8
chapter10/adt.hs Normal file
View File

@ -0,0 +1,8 @@
{-# LANGUAGE TypeOperators #-}
data Unit = Unit -- 1
data Empty -- 0
data (a * b) = Product a b -- a * b
data (a + b) = Inl a | Inr b -- a + b
data Exp a b = Exp (a -> b) -- a^b
data Rec f = Rec (f (Rec f)) --

View File

@ -55,11 +55,7 @@ lazy evaluation, interpreter, native code generator, a runtime, and several
optimization passes.
As with most of my writing, this is the pre-edited rough cut version, which I
will refine over time. The compiler itself is fully complete as of December
2014, but each of the chapters (28 in total) will be staggered on a
month-by-month basis to allow me to progressively refine the text with feedback
from readers and testers. The later chapters on runtime and code generation are
somewhat involved and much longer.
will refine over time.
* [Chapter 1: Introduction](000_introduction.html)
* [Chapter 2: Haskell Basics](001_basics.html)

21
write-you-a-haskell.cabal Normal file
View File

@ -0,0 +1,21 @@
name: write-you-a-haskell
version: 0.1.0.0
license: MIT
license-file: LICENSE
author: Stephen Diehl
maintainer: stephen.m.diehl@gmail.com
build-type: Simple
extra-source-files: README.md
cabal-version: >=1.10
executable write-you-a-haskell
main-is: Main.hs
build-depends:
base >= 4.7 && <4.8,
pretty >= 1.1 && <1.2,
containers >= 0.5 && <0.6,
transformers >= 0.3 && <0.4,
haskeline >= 0.7 && <0.8,
pandoc -any
build-tools: alex, happy
default-language: Haskell2010