An open API service indexing awesome lists of open source software.

https://github.com/anton-latukha/fundamental-haskell

Fundamental Haskell book, to the point terse statements on Haskell, Category theory, and related fields. Encyclopedic pocketbook of meaning. Zen kōan-like meditations of understanding. For quick or memory curve spaced repetition learning.
https://github.com/anton-latukha/fundamental-haskell

category-theory dictionary dictionary-learning emacs functional-programming haskell learning-resource org org-mode philosophy-of-science spaced-repetition

Last synced: 3 months ago
JSON representation

Fundamental Haskell book, to the point terse statements on Haskell, Category theory, and related fields. Encyclopedic pocketbook of meaning. Zen kōan-like meditations of understanding. For quick or memory curve spaced repetition learning.

Awesome Lists containing this project

README

          

Fundamental Haskell

<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: auto;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline; margin-top: 14px;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }

table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->

div.MathJax_Display{display: inline-block !important; width: auto;}

// @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.classList.add("code-highlighted");
target.classList.add("code-highlighted");
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.classList.remove("code-highlighted");
target.classList.remove("code-highlighted");
}
}
/*]]>*///-->
// @license-end

MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",

"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});


Fundamental Haskell


Encyclopedical handbook for learning and understanding fundamentals



Table of Contents








_oo0oo_
o88888o
88" . "88
(| -_- |)
0\ = /0
___/`---'\____
.' \| |// '.
/ /||| : |||/\ \
| _|\||| -:- ||||| \
/ | \\ - /// |\ \
| \_| ''\---/'' |/ |
\ .-\__ '-' ___/-. /
___'. .' /--.--\ `. .'___
."" '< `.___\_<|>_/___.' >' "".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `_. \_ __\ /__ _/ .-` / /
=====`-.____`.___ \_____/___.-`___.-'=====
`=---='




1 Introduction




“Employ your time in improving yourself by other men's writings so that you shall come easily by what others have labored hard for.”
(Socrates by Plato)


Important notes on Haskell, category theory & related fields, terms and recommendations.


Book comes in forms:



This book is created using complex Org markup file with a lot of LaTeX and LaTeX formulas.
Be aware - GitHub & GitLab only partially parse Org into HTML.


To get the full view:



  • Outline navigation



  • LaTeX formulas:


    \( {\displaystyle\left[{-\frac{\hbar^{2}}{2m}}\nabla^{2}+V(\vec{r},t)\right]\Psi({\vec{r}},t)=i\hbar{\partial\over\partial{t}}\Psi({\vec{r}},t),\quad\sum_{k,j}\left[-{\frac{\hbar^{2}}{\sqrt{a}}}{\frac{\partial}{\partial{q^{k}}}}\left({\sqrt{a}}a^{kj}{\frac{\partial}{\partial{q^{j}}}}\right)+V\right]\Psi+{\frac{\hbar}{i}}{\frac{\partial{\Psi}}{\partial{t}}}=0} \)



  • Interlinks: Interlinks


, please refere to Web book, PDF, LaTeX, of use Org-mode capable viewer/editor.


Note about the markup: <<<This is a radio target>>> - is the ancor for dynamic linking.


Users of Emacs can prettify radio targets to be shown as hyper-links with this Elisp snippet:


;;;;  2019-06-12: NOTE:

;;;; Prettify '<<<Radio targets>>>' to be shown as '_Radio_targets_',
;;;; when `org-descriptive-links` set.
;;;; This is improvement of the code from: Tobias&glmorous:
;;;; https://emacs.stackexchange.com/questions/19230/how-to-hide-targets
;;;; There exists library created from the sample:
;;;; https://github.com/talwrii/org-hide-targets
(defcustom org-hidden-links-additional-re "\\(<<<\\)[[:print:]]+?\\(>>>\\)"
"Regular expression that matches strings where the invisible-property
of thesub-matches 1 and 2 is set to org-link."
:type '(choice (const :tag "Off" nil) regexp)
:group 'org-link)
(make-variable-buffer-local 'org-hidden-links-additional-re)

(defun org-activate-hidden-links-additional (limit)
"Put invisible-property org-link on strings matching
`org-hide-links-additional-re'."
(if org-hidden-links-additional-re
(re-search-forward org-hidden-links-additional-re limit t)
(goto-char limit)
nil))

(defun org-hidden-links-hook-function ()
"Add rule for `org-activate-hidden-links-additional'
to `org-font-lock-extra-keywords'.
You can include this function in `org-font-lock-set-keywords-hook'."
(add-to-list 'org-font-lock-extra-keywords
'(org-activate-hidden-links-additional
(1 '(face org-target invisible org-link))
(2 '(face org-target invisible org-link)))))

(add-hook 'org-font-lock-set-keywords-hook #'org-hidden-links-hook-function)



SCHT: and metadata in :properties: - of my org-drill practices, please just run org-drill-strip-all-data.





2 Definitions





2.1 Algebra




\arabicfont{الجبر} al-jabr assemble parts


A system of parts based on given axioms (properties) and operations on them.


\additional


Additional meanings:



  1. Algebra - a set with its algebraic structure.


  2. Abstract algebra - the study of number systems and operations within them.


  3. Algebra - vector space over a field with a multiplication.




2.1.1 *





2.1.2 Algebraic




Composite from simple parts.


Also: Algebraic data type.





2.1.3 Algebraic structure




* includes axioms that must be satisfied and operations on the underlying (or "carrier") set.


An underlying set with * on top of it also called "an algebra".


* include groups, rings, fields, and lattices. More complex structures can be defined by introducing multiple operations, different underlying sets, or by altering the defining axioms. Examples of more complex * can be many modules, algebras and other vector spaces, and any variations that the definition includes.

Table 1: Algebraic structures

 
Closure
Associativity
Identity
Invertability
Commutativity
Distributive

Semigroupoid
 
&checkmark;
 
 
 
 

Small Category
 
&checkmark;
&checkmark;
 
 
 

Groupoid
 
&checkmark;
&checkmark;
&checkmark;
 
 

Magma
&checkmark;
 
 
 
 
 

Quasigroup
&checkmark;
 
 
&checkmark;
 
 

Loop
&checkmark;
 
&checkmark;
&checkmark;
 
 

Semigroup
&checkmark;
&checkmark;
 
 
 
 

Inverse Semigroup
&checkmark;
&checkmark;
 
&checkmark;
 
 

Monoid
&checkmark;
&checkmark;
&checkmark;
 
 
 

Group
&checkmark;
&checkmark;
&checkmark;
&checkmark;
 
 

Abelian group
&checkmark;
&checkmark;
&checkmark;
&checkmark;
&checkmark;
 

Non-unital ring (rng)
&checkmark; + ×
&checkmark; + ×
&checkmark; +
&checkmark; +
&checkmark; +
&checkmark;

Semiring (rig)
&checkmark; + ×
&checkmark; + ×
&checkmark; + ×
&checkmark; ×
&checkmark; +
&checkmark;

Ring
&checkmark; + ×
&checkmark; + ×
&checkmark; + ×
&checkmark; + ×
&checkmark; +
&checkmark;



2.1.3.2 Fundamental theorem of algebra



Any non-constant single-variable polynomial with complex coefficients has at least one complex root.


From this definition follows property that the field of complex numbers is algebraically closed.





2.1.3.3 Magma



Set with a binary operation which form a closure.




2.1.3.3.1 Semigroup



Magma with associative property of operation.


Defined in Haskell as:



class Semigroup a where

(<>) :: a -> a -> a



2.1.3.3.1.1 *


2.1.3.3.1.2 Monoid


Semigroup with identity element.


Ideal ground for any accumulation class.


class Semigroup m => Monoid m where

mempty :: m
mconcat :: [m] -> m
mconcat = foldr mappend mempty


More generally in category theory terms:


* - the object \( M \) equipped with two arrows:


\( \mu: \ M \ \otimes \ M \ \to M \) called multiplication or product, or tenzor product.
\( \eta: \ I \ \to \ M \) called unit,


so \((M, \ \mu, \ \eta )\). By its definition category (lets call it \( \mathb{C} \) should have \( \otimes \) and \( I \). Where \( \otimes: \ \mathb{C} \ \times \ \mathb{C} \ \to \ \mathb{C} \) is any operation that combines objects and stays (closed) inside category, so it may be even already category given operation of arrow composition. And \( I \) is an identity object of \( \otimes \) operation.


Category that has one object - always a free monoid (from definition of "Category" - composition, and there is only one object so it is always also the identity object).


For example to represent the whole non-negative integers with the one object and morphism "\( 1 \)" is absolutely enough, composition operation is "\( + \)".


import Data.Monoid

do
show (mempty :: Num a => Sum a)
-- "Sum {getSum = 0}"
show $ Sum 1
-- "Sum {getSum = 1}"
show $ (Sum 1) <> (Sum 1) <> (Sum 1)
-- "Sum {getSum = 3}"
-- ...


And backwards connection.
Any monoidal category can be isomorphically transformed into one-object bicategory, thou explaining or proving it is out of the current scope.


Any monad is equivalent up to isomorphism to monoid.



2.1.3.3.1.2.1 *


2.1.3.3.1.2.2 Monoid properties


2.1.3.3.1.2.2.1 Monoid left identity property


mempty <> x = x





2.1.3.3.1.2.2.2 Monoid right identity property


x <> mempty = x





2.1.3.3.1.2.2.3 Monoid associativity property


x <> mempty = x (y <> z) = (x <> y) <> z

mconcat = foldr (mempty <>)


Everything associative can be mappend.





2.1.3.3.1.2.3 Commutative monoid


Operation that forms structure has commutativity property:
\( x \circ y = y \circ x \)


Opens a big abilities in concurrent and distributed processing.



2.1.3.3.1.2.3.1 *



2.1.3.3.1.2.4 Group