mirror of
https://github.com/sdiehl/wiwinwlh.git
synced 2024-09-11 12:05:25 +03:00
Write more
This commit is contained in:
parent
312f9ac104
commit
4b844395d5
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,6 +11,7 @@ includes
|
|||||||
*.epub
|
*.epub
|
||||||
*.pdf
|
*.pdf
|
||||||
*.docx
|
*.docx
|
||||||
|
tutorial.tex
|
||||||
.stack-work
|
.stack-work
|
||||||
dist-newstyle
|
dist-newstyle
|
||||||
resources/*.eps
|
resources/*.eps
|
||||||
|
7
Makefile
7
Makefile
@ -44,8 +44,13 @@ includes: includes.hs
|
|||||||
(cat $(ETEMPLATE); ./includes < $<) \
|
(cat $(ETEMPLATE); ./includes < $<) \
|
||||||
| $(PANDOC) -f $(IFORMAT) -t epub $(FLAGS) $(EFLAGS) -o $@
|
| $(PANDOC) -f $(IFORMAT) -t epub $(FLAGS) $(EFLAGS) -o $@
|
||||||
|
|
||||||
|
%.tex: %.md includes $(COVER) $(BACK)
|
||||||
|
./includes < $< \
|
||||||
|
| $(PANDOC) -c -s -f $(IFORMAT) --template $(LTEMPLATE) --include-in-header $(UNICODE_MAP) --pdf-engine=xelatex $(FLAGS) $(LFLAGS) -o $@
|
||||||
|
|
||||||
%.pdf: %.md includes $(COVER) $(BACK)
|
%.pdf: %.md includes $(COVER) $(BACK)
|
||||||
./includes < $< | $(PANDOC) -c -s -f $(IFORMAT) --template $(LTEMPLATE) --include-in-header $(UNICODE_MAP) --pdf-engine=xelatex $(FLAGS) $(LFLAGS) -o $@
|
./includes < $< \
|
||||||
|
| $(PANDOC) -c -s -f $(IFORMAT) --template $(LTEMPLATE) --include-in-header $(UNICODE_MAP) --pdf-engine=xelatex $(FLAGS) $(LFLAGS) -o $@
|
||||||
|
|
||||||
links:
|
links:
|
||||||
brok tutorial.md
|
brok tutorial.md
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
\documentclass[10pt,openright]{$documentclass$}
|
\documentclass[10pt,openright]{$documentclass$}
|
||||||
\usepackage{geometry}
|
\usepackage{geometry}
|
||||||
|
\usepackage{afterpage}
|
||||||
\usepackage{resources/dtrt}
|
\usepackage{resources/dtrt}
|
||||||
\geometry{
|
\geometry{
|
||||||
%a4paper,
|
%a4paper,
|
||||||
%total={21.59cm,27.94cm},
|
%total={21.59cm,27.94cm},
|
||||||
%total={21cm,25cm},
|
%total={21cm,25cm},
|
||||||
papersize={21cm,25cm},
|
%papersize={21cm,25cm},
|
||||||
|
papersize={8.125in,10.250in},
|
||||||
top=1.5cm,
|
top=1.5cm,
|
||||||
bottom=1.5cm,
|
bottom=1.3cm,
|
||||||
inner=1.91cm,
|
inner=1.91cm,
|
||||||
outer=6.68cm,
|
outer=6.68cm,
|
||||||
% For pdf
|
% For pdf
|
||||||
left=1.5cm,
|
left=1.5cm,
|
||||||
right=1.5cm,
|
right=1.5cm,
|
||||||
% For print
|
% For print
|
||||||
%marginparwidth=4cm,
|
%marginparwidth=4cm,
|
||||||
@ -34,7 +36,6 @@ $if(colorlinks)$
|
|||||||
pdfauthor={Stephen Diehl},
|
pdfauthor={Stephen Diehl},
|
||||||
pdfsubject={Haskell Programming},
|
pdfsubject={Haskell Programming},
|
||||||
pdftitle={What I Wish I Knew When Learning Haskell},
|
pdftitle={What I Wish I Knew When Learning Haskell},
|
||||||
pdfkeywords={LaTeX, PDF, hyperlinks}
|
|
||||||
}
|
}
|
||||||
$else$
|
$else$
|
||||||
\hypersetup{%
|
\hypersetup{%
|
||||||
@ -44,7 +45,6 @@ $else$
|
|||||||
pdfauthor={Stephen Diehl},
|
pdfauthor={Stephen Diehl},
|
||||||
pdfsubject={Haskell Programming},
|
pdfsubject={Haskell Programming},
|
||||||
pdftitle={What I Wish I Knew When Learning Haskell},
|
pdftitle={What I Wish I Knew When Learning Haskell},
|
||||||
pdfkeywords={LaTeX, PDF, hyperlinks}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\newif\ifprint
|
\newif\ifprint
|
||||||
@ -58,17 +58,22 @@ $else$
|
|||||||
\fi
|
\fi
|
||||||
$endif$
|
$endif$
|
||||||
|
|
||||||
|
\newcommand\blankpage{%
|
||||||
|
\null
|
||||||
|
\thispagestyle{empty}%
|
||||||
|
\addtocounter{page}{-1}%
|
||||||
|
\newpage}
|
||||||
|
|
||||||
\usepackage{amssymb,amsmath}
|
\usepackage{amssymb,amsmath}
|
||||||
\usepackage{framed}
|
\usepackage{framed}
|
||||||
\usepackage{fancyvrb}
|
\usepackage{fancyvrb}
|
||||||
\usepackage{fancyhdr}
|
\usepackage{fancyhdr}
|
||||||
\usepackage{graphicx}
|
\usepackage{graphicx}
|
||||||
%\usepackage{pst-poker}
|
|
||||||
|
|
||||||
\pagestyle{fancy}
|
\pagestyle{fancy}
|
||||||
\fancyhf{}
|
\fancyhf{}
|
||||||
\fancyhead[RE,LO]{\leftmark}
|
\fancyhead[RE,LO]{\thepage}
|
||||||
\fancyhead[LE,RO]{\thepage}
|
\fancyhead[LE,RO]{\leftmark}
|
||||||
|
|
||||||
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
|
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
|
||||||
|
|
||||||
@ -89,8 +94,8 @@ $endif$
|
|||||||
framerule=0pt,
|
framerule=0pt,
|
||||||
xleftmargin=15pt,
|
xleftmargin=15pt,
|
||||||
framexleftmargin=16pt,
|
framexleftmargin=16pt,
|
||||||
framextopmargin=25pt,
|
framextopmargin=10pt,
|
||||||
framexbottommargin=25pt,
|
framexbottommargin=10pt,
|
||||||
stepnumber=1,
|
stepnumber=1,
|
||||||
numbers=left,
|
numbers=left,
|
||||||
numbersep=5pt,
|
numbersep=5pt,
|
||||||
@ -116,10 +121,9 @@ $endif$
|
|||||||
\usepackage[utf8]{inputenc}
|
\usepackage[utf8]{inputenc}
|
||||||
\usepackage{ifxetex,ifluatex}
|
\usepackage{ifxetex,ifluatex}
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
\setmainfont[Ligatures=Common,
|
\setmainfont[Ligatures=Common, ItalicFont={Adobe Garamond Pro Italic}]
|
||||||
ItalicFont={Adobe Garamond Pro Italic}]
|
|
||||||
{Adobe Garamond Pro}
|
{Adobe Garamond Pro}
|
||||||
\setmonofont[Ligatures=NoCommon, Scale=0.8]{Source Code Pro}
|
\setmonofont[Ligatures=NoCommon, Scale=0.75]{Source Code Pro}
|
||||||
|
|
||||||
\urlstyle{same}
|
\urlstyle{same}
|
||||||
\usepackage{longtable,booktabs}
|
\usepackage{longtable,booktabs}
|
||||||
@ -151,6 +155,7 @@ $if(numbersections)$
|
|||||||
$else$
|
$else$
|
||||||
\setcounter{secnumdepth}{0}
|
\setcounter{secnumdepth}{0}
|
||||||
$endif$
|
$endif$
|
||||||
|
|
||||||
$if(subparagraph)$
|
$if(subparagraph)$
|
||||||
$else$
|
$else$
|
||||||
% Redefines (sub)paragraphs to behave more like sections
|
% Redefines (sub)paragraphs to behave more like sections
|
||||||
@ -163,6 +168,7 @@ $else$
|
|||||||
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
|
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
|
||||||
\fi
|
\fi
|
||||||
$endif$
|
$endif$
|
||||||
|
|
||||||
$if(dir)$
|
$if(dir)$
|
||||||
\ifxetex
|
\ifxetex
|
||||||
% load bidi as late as possible as it modifies e.g. graphicx
|
% load bidi as late as possible as it modifies e.g. graphicx
|
||||||
@ -180,6 +186,7 @@ $if(dir)$
|
|||||||
\newenvironment{LTR}{\beginL}{\endL}
|
\newenvironment{LTR}{\beginL}{\endL}
|
||||||
\fi
|
\fi
|
||||||
$endif$
|
$endif$
|
||||||
|
|
||||||
$for(header-includes)$
|
$for(header-includes)$
|
||||||
$header-includes$
|
$header-includes$
|
||||||
$endfor$
|
$endfor$
|
||||||
@ -208,12 +215,12 @@ $if(toc)$
|
|||||||
{
|
{
|
||||||
\setcounter{tocdepth}{$toc-depth$}
|
\setcounter{tocdepth}{$toc-depth$}
|
||||||
\tableofcontents
|
\tableofcontents
|
||||||
|
|
||||||
\newpage
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$endif$
|
$endif$
|
||||||
|
|
||||||
|
\newpage
|
||||||
|
\clearpage
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
$body$
|
$body$
|
||||||
@ -226,7 +233,10 @@ $endfor$
|
|||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
\afterpage{\blankpage}
|
||||||
|
\clearpage
|
||||||
\newpage
|
\newpage
|
||||||
|
|
||||||
\input{resources/back.tex}
|
\input{resources/back.tex}
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
48
tutorial.md
48
tutorial.md
@ -650,19 +650,14 @@ version if the lower bound at the currently used version.
|
|||||||
```perl
|
```perl
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.6 && <4.14,
|
base >= 4.6 && <4.14,
|
||||||
array >= 0.4 && <0.6,
|
|
||||||
ghc-prim >= 0.3 && <0.6,
|
|
||||||
async >= 2.0 && <2.3,
|
async >= 2.0 && <2.3,
|
||||||
deepseq >= 1.3 && <1.5,
|
deepseq >= 1.3 && <1.5,
|
||||||
containers >= 0.5 && <0.7,
|
containers >= 0.5 && <0.7,
|
||||||
hashable >= 1.2 && <1.4,
|
hashable >= 1.2 && <1.4,
|
||||||
transformers >= 0.2 && <0.6,
|
transformers >= 0.2 && <0.6,
|
||||||
text >= 1.2 && <1.3,
|
text >= 1.2 && <1.3,
|
||||||
stm >= 2.4 && <2.6,
|
|
||||||
bytestring >= 0.10 && <0.11,
|
bytestring >= 0.10 && <0.11,
|
||||||
mtl >= 2.1 && <2.3,
|
mtl >= 2.1 && <2.3,
|
||||||
mtl-compat >= 0.2 && <0.3,
|
|
||||||
transformers-compat >= 0.4 && <0.7
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Individual lines in the version specification can be dependent on other
|
Individual lines in the version specification can be dependent on other
|
||||||
@ -6466,28 +6461,6 @@ data Tree a = Node a [Tree a]
|
|||||||
deriving (Show, Functor, Foldable, Traversable)
|
deriving (Show, Functor, Foldable, Traversable)
|
||||||
```
|
```
|
||||||
|
|
||||||
split
|
|
||||||
-----
|
|
||||||
|
|
||||||
The [split](http://hackage.haskell.org/package/split-0.1.1/docs/Data-List-Split.html) package provides a
|
|
||||||
variety of missing functions for splitting list and string types.
|
|
||||||
|
|
||||||
~~~~ {.haskell include="src/06-prelude/split.hs"}
|
|
||||||
~~~~
|
|
||||||
|
|
||||||
monad-loops
|
|
||||||
-----------
|
|
||||||
|
|
||||||
The [monad-loops](http://hackage.haskell.org/package/monad-loops-0.4.2/docs/Control-Monad-Loops.html) package
|
|
||||||
provides a variety of missing functions for control logic in monadic contexts.
|
|
||||||
|
|
||||||
```haskell
|
|
||||||
whileM :: Monad m => m Bool -> m a -> m [a]
|
|
||||||
untilM :: Monad m => m a -> m Bool -> m [a]
|
|
||||||
iterateUntilM :: Monad m => (a -> Bool) -> (a -> m a) -> a -> m a
|
|
||||||
whileJust :: Monad m => m (Maybe a) -> (a -> m b) -> m [b]
|
|
||||||
```
|
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
Strings
|
Strings
|
||||||
@ -6602,8 +6575,7 @@ fluffy :: Cat
|
|||||||
fluffy = "Fluffy"
|
fluffy = "Fluffy"
|
||||||
```
|
```
|
||||||
|
|
||||||
Import Conventions
|
**Import Conventions**
|
||||||
------------------
|
|
||||||
|
|
||||||
Since there are so many modules that provide string datatypes, and these modules
|
Since there are so many modules that provide string datatypes, and these modules
|
||||||
are used ubiquitously, some conventions are often adopted to import these
|
are used ubiquitously, some conventions are often adopted to import these
|
||||||
@ -6763,6 +6735,15 @@ Escape Unicode Character
|
|||||||
\\v U+000B vertical tab
|
\\v U+000B vertical tab
|
||||||
\\" U+0022 double quote
|
\\" U+0022 double quote
|
||||||
|
|
||||||
|
String Splitting
|
||||||
|
----------------
|
||||||
|
|
||||||
|
The [split](http://hackage.haskell.org/package/split-0.1.1/docs/Data-List-Split.html) package provides a
|
||||||
|
variety of missing functions for splitting list and string types.
|
||||||
|
|
||||||
|
~~~~ {.haskell include="src/06-prelude/split.hs"}
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
@ -16785,9 +16766,9 @@ The long answer: It is not strictly necessary to learn, but so few things in
|
|||||||
life are. Learning new topics and ways of thinking about problems only enrich
|
life are. Learning new topics and ways of thinking about problems only enrich
|
||||||
your thinking and give you new ways of thinking about code and abstractions.
|
your thinking and give you new ways of thinking about code and abstractions.
|
||||||
Category theory is never going to help you write a web application better but it
|
Category theory is never going to help you write a web application better but it
|
||||||
may give you insights into problems that algebraic in nature. A few (read as
|
may give you insights into problems that algebraic in nature. A tiny group of
|
||||||
less than 10) or so Haskellers espouse philosophies about it being an
|
Haskellers espouse philosophies about it being an inspiration for certain
|
||||||
inspiration for certain abstractions, but most do not.
|
abstractions, but most do not.
|
||||||
|
|
||||||
Some understanding of abstract algebra, conventions for discussing algebraic
|
Some understanding of abstract algebra, conventions for discussing algebraic
|
||||||
structures and equation reasoning with laws are essential to modern Haskell and
|
structures and equation reasoning with laws are essential to modern Haskell and
|
||||||
@ -16819,11 +16800,10 @@ specific names.
|
|||||||
|
|
||||||
Constants are specific elements of the set, that generalise values like 0 and 1
|
Constants are specific elements of the set, that generalise values like 0 and 1
|
||||||
which have specific laws in relation to the operations defined over the set.
|
which have specific laws in relation to the operations defined over the set.
|
||||||
Several of the common algebraic laws are defined in the table below:
|
|
||||||
|
|
||||||
Certain properties show up so frequently we typically refer to their properties
|
Certain properties show up so frequently we typically refer to their properties
|
||||||
by an algebraic term. These terms are drawn from an equivalent abstract algebra
|
by an algebraic term. These terms are drawn from an equivalent abstract algebra
|
||||||
concept.
|
concept. Several of the common algebraic laws are defined in the table below.
|
||||||
|
|
||||||
```{=latex}
|
```{=latex}
|
||||||
\noindent\rule{\textwidth}{1pt}
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
Loading…
Reference in New Issue
Block a user