mirror of
https://github.com/sdiehl/wiwinwlh.git
synced 2024-08-16 23:40:41 +03:00
Write more
This commit is contained in:
parent
de3ed731cb
commit
5b127bd40d
2
Makefile
2
Makefile
@ -8,7 +8,7 @@ ETEMPLATE = resources/page.epubt
|
||||
|
||||
UNICODE_MAP = resources/unicodemapping.tex
|
||||
|
||||
FLAGS = --standalone --toc --toc-depth=2 --highlight-style pygments
|
||||
FLAGS = --standalone --toc --toc-depth=2 --highlight-style tango
|
||||
LFLAGS = --top-level-division=chapter -V documentclass=book
|
||||
HFLAGS = -c css/style.css -c css/layout.css
|
||||
EFLAGS =
|
||||
|
144
img/cover.ps
Normal file
144
img/cover.ps
Normal file
@ -0,0 +1,144 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: cairo 1.16.0 (https://cairographics.org)
|
||||
%%CreationDate: Sat Jan 25 14:11:28 2020
|
||||
%%Pages: 1
|
||||
%%DocumentData: Clean7Bit
|
||||
%%LanguageLevel: 2
|
||||
%%DocumentMedia: 170x120mm 482 340 0 () ()
|
||||
%%BoundingBox: 0 0 482 341
|
||||
%%EndComments
|
||||
%%BeginProlog
|
||||
/languagelevel where
|
||||
{ pop languagelevel } { 1 } ifelse
|
||||
2 lt { /Helvetica findfont 12 scalefont setfont 50 500 moveto
|
||||
(This print job requires a PostScript Language Level 2 printer.) show
|
||||
showpage quit } if
|
||||
/q { gsave } bind def
|
||||
/Q { grestore } bind def
|
||||
/cm { 6 array astore concat } bind def
|
||||
/w { setlinewidth } bind def
|
||||
/J { setlinecap } bind def
|
||||
/j { setlinejoin } bind def
|
||||
/M { setmiterlimit } bind def
|
||||
/d { setdash } bind def
|
||||
/m { moveto } bind def
|
||||
/l { lineto } bind def
|
||||
/c { curveto } bind def
|
||||
/h { closepath } bind def
|
||||
/re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
|
||||
0 exch rlineto 0 rlineto closepath } bind def
|
||||
/S { stroke } bind def
|
||||
/f { fill } bind def
|
||||
/f* { eofill } bind def
|
||||
/n { newpath } bind def
|
||||
/W { clip } bind def
|
||||
/W* { eoclip } bind def
|
||||
/BT { } bind def
|
||||
/ET { } bind def
|
||||
/BDC { mark 3 1 roll /BDC pdfmark } bind def
|
||||
/EMC { mark /EMC pdfmark } bind def
|
||||
/cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
|
||||
/Tj { show currentpoint cairo_store_point } bind def
|
||||
/TJ {
|
||||
{
|
||||
dup
|
||||
type /stringtype eq
|
||||
{ show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
|
||||
} forall
|
||||
currentpoint cairo_store_point
|
||||
} bind def
|
||||
/cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
|
||||
cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
|
||||
/Tf { pop /cairo_font exch def /cairo_font_matrix where
|
||||
{ pop cairo_selectfont } if } bind def
|
||||
/Td { matrix translate cairo_font_matrix matrix concatmatrix dup
|
||||
/cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
|
||||
/cairo_font where { pop cairo_selectfont } if } bind def
|
||||
/Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
|
||||
cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
|
||||
/g { setgray } bind def
|
||||
/rg { setrgbcolor } bind def
|
||||
/d1 { setcachedevice } bind def
|
||||
/cairo_data_source {
|
||||
CairoDataIndex CairoData length lt
|
||||
{ CairoData CairoDataIndex get /CairoDataIndex CairoDataIndex 1 add def }
|
||||
{ () } ifelse
|
||||
} def
|
||||
/cairo_flush_ascii85_file { cairo_ascii85_file status { cairo_ascii85_file flushfile } if } def
|
||||
/cairo_image { image cairo_flush_ascii85_file } def
|
||||
/cairo_imagemask { imagemask cairo_flush_ascii85_file } def
|
||||
/cairo_set_page_size {
|
||||
% Change paper size, but only if different from previous paper size otherwise
|
||||
% duplex fails. PLRM specifies a tolerance of 5 pts when matching paper size
|
||||
% so we use the same when checking if the size changes.
|
||||
/setpagedevice where {
|
||||
pop currentpagedevice
|
||||
/PageSize known {
|
||||
2 copy
|
||||
currentpagedevice /PageSize get aload pop
|
||||
exch 4 1 roll
|
||||
sub abs 5 gt
|
||||
3 1 roll
|
||||
sub abs 5 gt
|
||||
or
|
||||
} {
|
||||
true
|
||||
} ifelse
|
||||
{
|
||||
2 array astore
|
||||
2 dict begin
|
||||
/PageSize exch def
|
||||
/ImagingBBox null def
|
||||
currentdict end
|
||||
setpagedevice
|
||||
} {
|
||||
pop pop
|
||||
} ifelse
|
||||
} {
|
||||
pop
|
||||
} ifelse
|
||||
} def
|
||||
%%EndProlog
|
||||
%%BeginSetup
|
||||
%%EndSetup
|
||||
%%Page: 1 1
|
||||
%%BeginPageSetup
|
||||
%%PageMedia: 170x120mm
|
||||
%%PageBoundingBox: 0 0 482 341
|
||||
482 341 cairo_set_page_size
|
||||
%%EndPageSetup
|
||||
q 0 0 482 341 rectclip
|
||||
1 0 0 -1 0 341 cm q
|
||||
Q q
|
||||
q
|
||||
0 0 482 341 re W n
|
||||
[ 1 0 0 1 0 0 ] concat
|
||||
q
|
||||
0 g
|
||||
8.503937 w
|
||||
0 J
|
||||
0 j
|
||||
[] 0.0 d
|
||||
4 M q 1 0 0 1 0 0 cm
|
||||
0 340.156 m 37.797 283.465 75.59 226.77 113.387 170.078 c 75.59 113.387
|
||||
37.797 56.691 0 0 c 28.348 0 56.691 0 85.039 0 c 122.836 56.691 160.629
|
||||
113.387 198.426 170.078 c 160.629 226.77 122.836 283.465 85.039 340.156
|
||||
c 56.691 340.156 28.348 340.156 0 340.156 c h
|
||||
0 340.156 m S Q
|
||||
q 1 0 0 1 0 0 cm
|
||||
113.387 340.156 m 226.773 170.078 l 113.387 0 l 198.426 0 l 425.195 340.156
|
||||
l 340.156 340.156 l 269.293 233.859 l 198.426 340.156 l h
|
||||
113.387 340.156 m S Q
|
||||
q 1 0 0 1 0 0 cm
|
||||
387.402 240.945 m 349.609 184.254 l 481.891 184.25 l 481.891 240.945 l
|
||||
h
|
||||
387.402 240.945 m S Q
|
||||
q 1 0 0 1 0 0 cm
|
||||
330.711 155.906 m 292.914 99.215 l 481.891 99.211 l 481.891 155.906 l h
|
||||
330.711 155.906 m S Q
|
||||
Q
|
||||
Q
|
||||
Q Q
|
||||
showpage
|
||||
%%Trailer
|
||||
%%EOF
|
92
resources/haskell.sty
Normal file
92
resources/haskell.sty
Normal file
@ -0,0 +1,92 @@
|
||||
\usepackage{xcolor}
|
||||
\usepackage{xcolor-solarized}
|
||||
\usepackage{textcomp}
|
||||
|
||||
\definecolor{sbase03}{HTML}{002B36}
|
||||
\definecolor{sbase02}{HTML}{073642}
|
||||
\definecolor{sbase01}{HTML}{586E75}
|
||||
\definecolor{sbase00}{HTML}{657B83}
|
||||
\definecolor{sbase0}{HTML}{839496}
|
||||
\definecolor{sbase1}{HTML}{93A1A1}
|
||||
\definecolor{sbase2}{HTML}{EEE8D5}
|
||||
\definecolor{sbase3}{HTML}{FDF6E3}
|
||||
\definecolor{syellow}{HTML}{B58900}
|
||||
\definecolor{sorange}{HTML}{CB4B16}
|
||||
\definecolor{sred}{HTML}{DC322F}
|
||||
\definecolor{smagenta}{HTML}{D33682}
|
||||
\definecolor{sviolet}{HTML}{6C71C4}
|
||||
\definecolor{sblue}{HTML}{268BD2}
|
||||
\definecolor{scyan}{HTML}{2AA198}
|
||||
\definecolor{sgreen}{HTML}{859900}
|
||||
|
||||
\providecommand{\KeywordTok}{}
|
||||
\providecommand{\DataTypeTok}{}
|
||||
\providecommand{\DecValTok}{}
|
||||
\providecommand{\BaseNTok}{}
|
||||
\providecommand{\FloatTok}{}
|
||||
\providecommand{\ConstantTok}{}
|
||||
\providecommand{\CharTok}{}
|
||||
\providecommand{\SpecialCharTok}{}
|
||||
\providecommand{\StringTok}{}
|
||||
\providecommand{\VerbatimStringTok}{}
|
||||
\providecommand{\SpecialStringTok}{}
|
||||
\providecommand{\ImportTok}{}
|
||||
\providecommand{\CommentTok}{}
|
||||
\providecommand{\DocumentationTok}{}
|
||||
\providecommand{\AnnotationTok}{}
|
||||
\providecommand{\CommentVarTok}{}
|
||||
\providecommand{\OtherTok}{}
|
||||
\providecommand{\FunctionTok}{}
|
||||
\providecommand{\VariableTok}{}
|
||||
\providecommand{\ControlFlowTok}{}
|
||||
\providecommand{\OperatorTok}{}
|
||||
\providecommand{\BuiltInTok}{}
|
||||
\providecommand{\ExtensionTok}{}
|
||||
\providecommand{\PreprocessorTok}{}
|
||||
\providecommand{\AttributeTok}{}
|
||||
\providecommand{\RegionMarkerTok}{}
|
||||
\providecommand{\InformationTok}{}
|
||||
\providecommand{\WarningTok}{}
|
||||
\providecommand{\AlertTok}{}
|
||||
\providecommand{\ErrorTok}{}
|
||||
\providecommand{\NormalTok}{}
|
||||
|
||||
\DefineShortVerb[commandchars=\\\{\}]{\|}
|
||||
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
|
||||
|
||||
\newenvironment{Shaded}{\begin{shaded}}{\end{shaded}}
|
||||
\definecolor{shadecolor}{gray}{0.97}
|
||||
\renewcommand{\KeywordTok}[1]{\textcolor{sblue}{\textbf{#1}}}
|
||||
\renewcommand{\DataTypeTok}[1]{\textcolor{syellow}{{#1}}}
|
||||
\renewcommand{\DecValTok}[1]{\textcolor{scyan}{{#1}}}
|
||||
\renewcommand{\BaseNTok}[1]{\textcolor{scyan}{{#1}}}
|
||||
\renewcommand{\FloatTok}[1]{\textcolor{scyan}{{#1}}}
|
||||
\renewcommand{\ConstantTok}[1]{\textcolor{scyan}{{#1}}}
|
||||
\renewcommand{\CharTok}[1]{\textcolor{scyan}{{#1}}}
|
||||
\renewcommand{\SpecialCharTok}[1]{\textcolor{sred}{{#1}}}
|
||||
\renewcommand{\StringTok}[1]{\textcolor{scyan}{{#1}}}
|
||||
\renewcommand{\VerbatimStringTok}[1]{{#1}}
|
||||
\renewcommand{\SpecialStringTok}[1]{\textcolor{sred}{{#1}}}
|
||||
\renewcommand{\ImportTok}[1]{{#1}}
|
||||
\renewcommand{\CommentTok}[1]{\textcolor{sbase1}{\textit{{#1}}}}
|
||||
\renewcommand{\DocumentationTok}[1]{\textcolor{sbase1}{\textit{{#1}}}}
|
||||
\renewcommand{\AnnotationTok}[1]{\textcolor{sbase1}{\textbf{\textit{{#1}}}}}
|
||||
\renewcommand{\CommentVarTok}[1]{\textcolor{sbase1}{\textbf{\textit{{#1}}}}}
|
||||
\renewcommand{\OtherTok}[1]{\textcolor{sblue}{#1}}
|
||||
\renewcommand{\FunctionTok}[1]{\textcolor{sblue}{{#1}}}
|
||||
\renewcommand{\VariableTok}[1]{\textcolor{sblue}{{#1}}}
|
||||
\renewcommand{\ControlFlowTok}[1]{\textcolor{sgreen}{\textbf{{#1}}}}
|
||||
\renewcommand{\OperatorTok}[1]{\textcolor{sgreen}{{#1}}}
|
||||
\renewcommand{\BuiltInTok}[1]{{#1}}
|
||||
\renewcommand{\ExtensionTok}[1]{{#1}}
|
||||
\renewcommand{\PreprocessorTok}[1]{\textcolor{sorange}{{#1}}}
|
||||
\renewcommand{\AttributeTok}[1]{{#1}}
|
||||
\renewcommand{\RegionMarkerTok}[1]{{#1}}
|
||||
\renewcommand{\InformationTok}[1]{\textcolor{sbase1}{\textbf{\textit{{#1}}}}}
|
||||
\renewcommand{\WarningTok}[1]{\textcolor{sorange}{\textbf{\textit{{#1}}}}}
|
||||
\renewcommand{\AlertTok}[1]{\textcolor{sred}{\textbf{{#1}}}}
|
||||
\renewcommand{\ErrorTok}[1]{\textcolor{sred}{\textbf{{#1}}}}
|
||||
\renewcommand{\NormalTok}[1]{{#1}}
|
||||
|
||||
% Paragraph Literals
|
||||
\renewcommand{\texttt}[1]{\colorbox{sbase2}{{\ttfamily #1}}}
|
@ -26,12 +26,18 @@
|
||||
\usepackage{amssymb,amsmath}
|
||||
\usepackage{framed}
|
||||
\usepackage{fancyvrb}
|
||||
\usepackage{catchfile}
|
||||
|
||||
% Syntax Higlighting
|
||||
\usepackage{listings}
|
||||
|
||||
\usepackage{resources/haskell}
|
||||
|
||||
\lstset{
|
||||
language=haskell,
|
||||
frame=ltb,
|
||||
framerule=0pt,
|
||||
xleftmargin=2pt,
|
||||
xleftmargin=15pt,
|
||||
framexleftmargin=16pt,
|
||||
framextopmargin=25pt,
|
||||
framexbottommargin=25pt,
|
||||
@ -64,9 +70,6 @@
|
||||
|
||||
\urlstyle{same}
|
||||
|
||||
$if(highlighting-macros)$
|
||||
$highlighting-macros$
|
||||
$endif$
|
||||
$if(tables)$
|
||||
\usepackage{longtable,booktabs}
|
||||
$endif$
|
||||
@ -147,27 +150,33 @@ $endfor$
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\begin{titlepage}
|
||||
\definecolor{titlepagecolor}{HTML}{8A1C0A}
|
||||
\definecolor{titlepagecolor}{HTML}{FDF6E3}
|
||||
\definecolor{namecolor}{cmyk}{1,.50,0,.10}
|
||||
\pagecolor{titlepagecolor}
|
||||
\color{white}
|
||||
|
||||
\vspace*{\stretch{1.0}}
|
||||
\begin{center}
|
||||
\Huge\textbf{What I Wish I Knew When Learning Haskell}\\
|
||||
\large\textit{Stephen Diehl}
|
||||
\vspace*{\stretch{0.5}}
|
||||
\Large\textit{Stephen Diehl}
|
||||
\end{center}
|
||||
\vspace*{\stretch{2.0}}
|
||||
|
||||
\begin{figure}
|
||||
\centering
|
||||
\includegraphics[height=3in,width=3in]{img/Haskell-Logo.ps}
|
||||
\includegraphics[height=3in,width=3in]{img/cover.ps}
|
||||
\end{figure}
|
||||
|
||||
\end{titlepage}
|
||||
\pagecolor{white}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\textbf{Date}: \today \\
|
||||
\textbf{Git Commit:} \texttt{\input{.git/ORIG_HEAD}}
|
||||
|
||||
\newpage
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
$if(abstract)$
|
||||
\begin{abstract}
|
||||
$abstract$
|
||||
|
@ -13,4 +13,6 @@
|
||||
\newunicodechar{•}{\ensuremath{\sbullet}}
|
||||
\newunicodechar{λ}{\ensuremath{\lambda}}
|
||||
\newunicodechar{Λ}{\ensuremath{\Lambda}}
|
||||
\newunicodechar{∎}{\ensuremath{\blacksquare}}
|
||||
\newunicodechar{μ}{\ensuremath{\mu}}
|
||||
\newunicodechar{ℕ}{\ensuremath{\mathbb{N}}}
|
||||
|
64
tutorial.md
64
tutorial.md
@ -2,8 +2,6 @@
|
||||
% Stephen Diehl
|
||||
% January 2020
|
||||
|
||||
Stephen Diehl (<a class="author" href="https://twitter.com/smdiehl">@smdiehl</a> )
|
||||
|
||||
Version
|
||||
-------
|
||||
|
||||
@ -3598,7 +3596,7 @@ Partial types may be used to avoid writing uninteresting pieces of the
|
||||
signature, which can be convenient in development:
|
||||
|
||||
```haskell
|
||||
{-# OPTIONS -XPartialTypeSignatures #-}
|
||||
{-# LANGUAGE PartialTypeSignatures #-}
|
||||
|
||||
triple :: Int -> _
|
||||
triple i = (i,i,i)
|
||||
@ -3607,8 +3605,9 @@ triple i = (i,i,i)
|
||||
If the `-Wpartial-type-signatures` GHC option is set, partial types will still
|
||||
trigger warnings.
|
||||
|
||||
See: [Partial Type Signatures](https://ghc.haskell.org/trac/ghc/wiki/PartialTypeSignatures)
|
||||
See:
|
||||
|
||||
* [Partial Type Signatures](https://ghc.haskell.org/trac/ghc/wiki/PartialTypeSignatures)
|
||||
|
||||
RecursiveDo
|
||||
-----------
|
||||
@ -10208,13 +10207,8 @@ Cryptonite is the standard Haskell cryptography library. It provides support for
|
||||
hash functions, elliptic curve cryptography, ciphers, one time passwords,
|
||||
entropy generation and safe memory handling.
|
||||
|
||||
* AES
|
||||
* Ed25519
|
||||
* Curve25519
|
||||
* Blake2
|
||||
* Argon2
|
||||
|
||||
**Hashing**
|
||||
SHA Hashing
|
||||
-----------
|
||||
|
||||
A cryptographic hash function is a special class of hash function that has
|
||||
certain properties which make it suitable for use in cryptography. It is a
|
||||
@ -10222,21 +10216,29 @@ mathematical algorithm that maps data of arbitrary size to a bit string of a
|
||||
fixed size (a hash function) which is designed to also be a one-way function,
|
||||
that is, a function which is infeasible to invert.
|
||||
|
||||
#### SHA3
|
||||
|
||||
~~~~ {.haskell include="src/32-cryptography/Keccak.hs"}
|
||||
~~~~
|
||||
|
||||
#### SHA256
|
||||
|
||||
SHA-256 is a cryptographic hash function from the SHA-2 family and is
|
||||
standardized by NIST. It produces a 256-bit message digest.
|
||||
|
||||
~~~~ {.haskell include="src/32-cryptography/SHA.hs"}
|
||||
~~~~
|
||||
|
||||
memory
|
||||
------
|
||||
~~~~ {.haskell include="src/32-cryptography/Keccak.hs"}
|
||||
~~~~
|
||||
|
||||
Password Hashing
|
||||
----------------
|
||||
|
||||
Curve25519 Diffie-Hellman
|
||||
-------------------------
|
||||
|
||||
Ed25519 EdDSA
|
||||
-------------
|
||||
|
||||
* Blake2
|
||||
* Argon2
|
||||
|
||||
Secure Memory Handling
|
||||
----------------------
|
||||
|
||||
ByteArray
|
||||
|
||||
@ -10252,26 +10254,32 @@ convertToBase :: (ByteArrayAccess bin, ByteArray bout) => Base -> bin -> bout
|
||||
convertFromBase :: (ByteArrayAccess bin, ByteArray bout) => Base -> bin -> Either String bout
|
||||
```
|
||||
|
||||
galois-field
|
||||
------------
|
||||
AES Ciphers
|
||||
-----------
|
||||
|
||||
TODO
|
||||
|
||||
elliptic-curve
|
||||
--------------
|
||||
Galois Fields
|
||||
-------------
|
||||
|
||||
TODO
|
||||
|
||||
pairing
|
||||
-------
|
||||
Elliptic Curves
|
||||
---------------
|
||||
|
||||
TODO
|
||||
|
||||
arithmetic-circuits
|
||||
-------------------
|
||||
Pairing Cryptography
|
||||
--------------------
|
||||
|
||||
TODO
|
||||
|
||||
zkSNARKs
|
||||
--------
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
Date and Time
|
||||
=============
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user