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.
- Host: GitHub
- URL: https://github.com/anton-latukha/fundamental-haskell
- Owner: Anton-Latukha
- Created: 2018-03-23T09:38:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-02T10:45:34.000Z (over 4 years ago)
- Last Synced: 2024-10-28T06:57:36.924Z (over 1 year ago)
- Topics: category-theory, dictionary, dictionary-learning, emacs, functional-programming, haskell, learning-resource, org, org-mode, philosophy-of-science, spaced-repetition
- Language: Emacs Lisp
- Homepage: https://blog.latukha.com/haskell-notes
- Size: 73.7 MB
- Stars: 121
- Watchers: 6
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.html
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
- 1. Introduction
-
2. Definitions
-
2.1. Algebra
- 2.1.1. *
- 2.1.2. Algebraic
-
2.1.3. Algebraic structure
- 2.1.3.1. *
- 2.1.3.2. Fundamental theorem of algebra
-
2.1.3.3. Magma
-
2.1.3.3.1. Semigroup
- 2.1.3.3.1.1. *
-
2.1.3.3.1.2. 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
- 2.1.3.3.1.2.2.2. Monoid right identity property
- 2.1.3.3.1.2.2.3. Monoid associativity property
-
2.1.3.3.1.2.3. Commutative monoid
-
2.1.3.3.1.2.4. Group
-
2.1.4. Modular arithmetic
-
2.2. Category theory
- 2.2.1. *
-
2.2.2. Abelian category
-
2.2.3. Composition
- 2.2.4. Endofunctor category
-
2.2.5. Functor
- 2.2.5.1. *
-
2.2.5.2. Power set functor
- 2.2.5.2.1. *
-
2.2.5.2.2. Power set functor properties
- 2.2.5.2.2.1. *
- 2.2.5.2.2.2. Power set functor identity property
- 2.2.5.2.2.3. Power set functor composition property
-
2.2.5.2.3. Lift
- 2.2.5.2.4. Power set functor is a free monad
-
2.2.5.3. Forgetful functor
- 2.2.5.4. Identity functor
-
2.2.5.5. Endofunctor
-
2.2.5.6. Applicative functor
- 2.2.5.6.1. *
- 2.2.5.6.2. Applicative property
-
2.2.5.6.3. *
- 2.2.5.6.3.1. Applicative identity property
- 2.2.5.6.3.2. Applicative composition property
- 2.2.5.6.3.3. Applicative homomorphism property
- 2.2.5.6.3.4. Applicative interchange property
-
2.2.5.6.4. Applicative function
-
2.2.5.6.4.1. liftA*
- 2.2.5.6.4.1.1. liftA
- 2.2.5.6.4.1.2. liftA2
- 2.2.5.6.4.1.3. <<<liftA2 (<*>)>>>
- 2.2.5.6.4.1.4. liftA2 (liftA2 (<*>))
- 2.2.5.6.4.1.5. liftA3
- 2.2.5.6.4.2. Conditional applicative computations
-
2.2.5.6.5. Special applicatives
- 2.2.5.6.5.1. Identity applicative
- 2.2.5.6.5.2. Constant applicative
- 2.2.5.6.5.3. Maybe applicative
- 2.2.5.6.5.4. Either applicative
- 2.2.5.6.5.5. Validation applicative
-
2.2.5.6.6. Monad
- 2.2.5.6.6.1. *
-
2.2.5.6.6.2. Monad property
- 2.2.5.6.6.2.1. *
- 2.2.5.6.6.2.2. Monad left identity property
- 2.2.5.6.6.2.3. Monad right identity property
- 2.2.5.6.6.2.4. Monad associativity property
-
2.2.5.6.6.3. Monad type class
- 2.2.5.6.6.4. Functor -> Applicative -> Monad progression
-
2.2.5.6.6.5. Monad function
- 2.2.5.6.6.5.1. Return function
-
2.2.5.6.6.5.2. Join function
-
2.2.5.6.6.5.3. Bind function
- 2.2.5.6.6.5.4. Sequencing operator
(>> ) \equiv ( *>):
- 2.2.5.6.6.5.5. Monadic versions of list functions
-
2.2.5.6.6.5.6. liftM*
- 2.2.5.6.6.6. Comonad
-
2.2.5.6.6.7. Kleisli arrow
- 2.2.5.6.6.8. Kleisli composition
- 2.2.5.6.6.9. Kleisli category
-
2.2.5.6.6.10. Special monad
- 2.2.5.6.6.10.1. Identity monad
- 2.2.5.6.6.10.2. Maybe monad
- 2.2.5.6.6.10.3. Either monad
- 2.2.5.6.6.10.4. Error monad
-
2.2.5.6.6.10.5. List monad
- 2.2.5.6.6.10.6. Reader monad
- 2.2.5.6.6.10.7. Writer monad
- 2.2.5.6.6.10.8. State monad
-
2.2.5.6.6.11. Monad transformer
- 2.2.5.6.6.11.1. MaybeT
-
2.2.5.6.6.11.2. EitherT
- 2.2.5.6.6.11.3. ReaderT
-
2.2.5.6.6.11.4. MonadTrans type class
-
2.2.5.6.7. Alternative type class
- 2.2.5.7. Monoidal functor
-
2.2.5.8. $>
-
2.2.5.9. Multifunctor
-
2.2.6. Hask category
-
2.2.7. Morphism
- 2.2.7.1. *
-
2.2.7.2. Homomorphism
-
2.2.7.3. Identity morphism
-
2.2.7.3.1. Identity
- 2.2.7.3.1.1. Two-sided identity of a predicate
- 2.2.7.3.1.2. Left identity of a predicate
- 2.2.7.3.1.3. Right identity of a predicate
- 2.2.7.3.2. Identity function
-
2.2.7.4. Monomorphism
-
2.2.7.5. Epimorphism
-
2.2.7.6. Isomorphism
-
2.2.7.7. Endomorphism
-
2.2.7.8. Catamorphism
-
2.2.7.9. Kernel
- 2.2.8. Set category
-
2.2.9. Natural transformation
- 2.2.9.1. *
-
2.2.9.2. Natural transformation component
- 2.2.9.3. Natural transformation in Haskell
-
2.2.9.4. Cat category
-
2.2.10. Category dual
-
2.2.11. Thin category
-
2.2.12. Commuting diagram
-
2.2.13. Universal construction
-
2.2.14. Product
-
2.2.15. Coproduct
- 2.2.16. Free object
- 2.2.17. Internal category
-
2.2.18. Hom set
-
2.2.19. Mag category
-
2.3. Data type
- 2.3.1. *
- 2.3.2. Actual type
-
2.3.3. Algebraic data type
-
2.3.4. Cardinality
- 2.3.5. Data constant
- 2.3.6. Data constructor
- 2.3.7. data declaration
-
2.3.8. Dependent type
- 2.3.9. Gen type
-
2.3.10. Higher-kinded data type
- 2.3.11. newtype declaration
- 2.3.12. Principal type
-
2.3.13. Product data type
- 2.3.14. Proxy type
- 2.3.15. Static typing
-
2.3.16. Structural type
-
2.3.17. Structural type system
- 2.3.18. Sum data type
- 2.3.19. Type alias
-
2.3.20. Type class
- 2.3.20.1. *
-
2.3.20.2. Arbitrary type class
-
2.3.20.3. CoArbitrary type class
-
2.3.20.4. Typeable type class
- 2.3.20.5. Type class inheritance
-
2.3.20.6. Derived instance
- 2.3.21. Type constant
- 2.3.22. Type constructor
- 2.3.23. type declaration
-
2.3.24. Typed hole
-
2.3.25. Type inference
- 2.3.26. Type class instance
-
2.3.27. Type rank
- 2.3.28. Type variable
-
2.3.29. Unlifted type
-
2.3.30. Linear type
- 2.3.31. NonEmpty list data type
- 2.3.32. Session type
- 2.3.33. Binary tree
-
2.3.34. Bottom value
-
2.3.35. Bound
-
2.3.36. Constructor
-
2.3.37. Context
- 2.3.38. Inhabit
-
2.3.39. Maybe
- 2.3.40. Expected type
- 2.3.41. ADT
- 2.3.42. Concrete type
- 2.3.43. Type punning
-
2.3.44. Kind
- 2.3.45. IO
-
2.4. Expression
- 2.4.1. *
- 2.4.2. Closed-form expression
- 2.4.3. RHS
- 2.4.4. LHS
- 2.4.5. Redex
- 2.4.6. Concatenate
- 2.4.7. Alpha equivalence
-
2.4.8. Ground expression
-
2.4.9. Variable
- 2.4.10. Phrase
-
2.5. Function
- 2.5.1. *
- 2.5.2. Arity
-
2.5.3. Bijection
-
2.5.4. Combinator
-
2.5.5. Function application
- 2.5.6. Function body
-
2.5.7. Function composition
- 2.5.8. Function head
- 2.5.9. Function range
-
2.5.10. Higher-order function
-
2.5.11. Injection
- 2.5.12. Partial function
-
2.5.13. Purity
- 2.5.14. Pure function
- 2.5.15. Sectioning
-
2.5.16. Surjection
-
2.5.17. Unsafe function
- 2.5.18. Variadic
- 2.5.19. Domain
- 2.5.20. Codomain
- 2.5.21. Open formula
-
2.5.22. Recursion
- 2.5.23. Free variable
-
2.5.24. Closure
-
2.5.25. Parameter
-
2.5.26. Partial application
-
2.5.27. Well-formed formula
-
2.6. Homotopy
-
2.7. Lambda calculus
- 2.7.1. *
-
2.7.2. Lambda cube
-
2.7.3. Lambda function
-
2.7.4. β-reduction
-
2.7.5. Calculus of constructions
-
2.7.6. Curry–Howard correspondence
-
2.7.7. Currying
-
2.7.8. Hindley–Milner type system
-
2.7.9. Reduction
-
2.7.10. β-η normal form
-
2.7.11. η-abstraction
- 2.7.12. Lambda expression
-
2.8. Operation
- 2.8.1. Constant
-
2.8.2. Binary operation
-
2.8.3. Operator
- 2.8.4. Infix
-
2.8.5. Fixity
- 2.8.6. Zero
-
2.8.7. Bind
- 2.8.8. Declaration
- 2.8.9. Dispatch
- 2.8.10. Evaluation
- 2.9. Permutation
-
2.10. Point-free
-
2.11. Polymorphism
- 2.11.1. *
- 2.11.2. Levity polymorphism
-
2.11.3. Parametric polymorphism
-
2.11.3.1. Rank-1 polymorphism
- 2.11.3.2. Let-bound polymorphism
-
2.11.3.3. Constrained polymorphism
-
2.11.3.4. Impredicative polymorphism
-
2.11.3.5. Higher-rank polymorphism
- 2.11.4. Subtype polymorphism
- 2.11.5. Row polymorphism
- 2.11.6. Kind polymorphism
- 2.11.7. Linearity polymorphism
-
2.12. Compositionality
-
2.13. Referential transparency
-
2.14. Semantics
-
2.14.1. Operational semantics
-
2.14.2. Denotational semantics
-
2.14.2.1. Abstraction
- 2.14.2.1.1. *
-
2.14.2.1.2. Leaky abstraction
-
2.14.2.1.3. Object
- 2.14.2.1.3.1. *
-
2.14.2.1.3.2. Arrow
- 2.14.2.1.3.3. Terminal object
- 2.14.2.1.3.4. Initial object
-
2.14.2.1.3.5. Value
-
2.14.2.1.3.6. Tensor
- 2.14.2.2. Ambigram
- 2.14.2.3. Binary
- 2.14.2.4. Arbitrary
- 2.14.2.5. Refutable
- 2.14.2.6. Irrefutable
- 2.14.2.7. Superclass
- 2.14.2.8. Unit
- 2.14.2.9. Nullary
-
2.14.2.10. Syntax tree
- 2.14.2.11. Stream
-
2.14.2.12. Linear
- 2.14.2.13. Predicative
-
2.14.2.14. Quantifier
-
2.14.2.15. Idiom
- 2.14.2.16. Impredicative
-
2.14.3. Axiomatic semantics
-
2.14.3.1. Property
- 2.14.3.1.1. *
-
2.14.3.1.2. Associativity
- 2.14.3.1.2.1. *
-
2.14.3.1.2.2. Left-associativity
-
2.14.3.1.2.3. Right-associativity
-
2.14.3.1.2.4. Non-associativity
-
2.14.3.1.3. Basis
-
2.14.3.1.4. Commutativity
-
2.14.3.1.5. Idempotence
-
2.14.3.1.6. Distributivity
- 2.14.3.2. Effect
-
2.14.3.3. Bisimulation
-
2.14.3.4. Primitive operation
- 2.14.4. Content word
-
2.14.5. Ancient Greek and Latin prefixes
-
2.15. Set
- 2.15.1. *
- 2.15.2. Axiom of choice
- 2.15.3. Closed set
- 2.15.4. Power set
- 2.15.5. Singleton
- 2.15.6. Russell's paradox
-
2.15.7. Cartesian product
-
2.15.8. Zermelo–Fraenkel set theory
-
2.16. Testing
-
2.16.1. Property testing
- 2.16.1.1. Function property
- 2.16.1.2. Property testing type
-
2.16.1.3. Generator
-
2.16.1.4. Reusing test code
- 2.16.1.4.1. Test Commutative property
- 2.16.1.4.2. Test Symmetry property
- 2.16.1.4.3. Test Equivalence property
- 2.16.1.4.4. Test Inverse property
-
2.16.1.5. QuickCheck
- 2.16.2. Write tests algorithm
- 2.16.3. Shrinking
-
2.17. Logic
-
2.17.1. Proposition
- 2.17.1.1. *
-
2.17.1.2. Atomic proposition
-
2.17.1.3. Compound proposition
-
2.17.1.4. Propositional logic
-
2.17.2. Logical connective
- 2.17.3. Predicate
-
2.17.4. Statement
- 2.17.5. Iff
-
2.18. Haskell structure
- 2.18.1. *
-
2.18.2. Pattern match
-
2.18.2.1. As-pattern
-
2.18.2.2. Wild-card
- 2.18.2.3. Case
-
2.18.2.4. Guard
-
2.18.2.5. Pattern guard
-
2.18.2.6. Lazy pattern
-
2.18.2.7. Pattern binding
- 2.18.3. Smart constructor
-
2.18.4. Level of code
- 2.18.4.1. *
-
2.18.4.2. Type level
- 2.18.4.3. Term level
-
2.18.4.4. Compile level
- 2.18.4.5. Runtime level
-
2.18.4.6. Kind level
- 2.18.5. Orphan instance
- 2.18.6. undefined
-
2.18.7. Hierarchical module name
-
2.18.8. Reserved word
-
2.18.9. Haskell Language Report
-
2.18.10. Haskell'
- 2.18.11. Lense
-
2.18.12. Pragma
-
2.18.12.1. LANGUAGE pragma
-
2.18.12.1.1. LANGUAGE option
- 2.18.12.1.1.1. *
- 2.18.12.1.1.2. Useful by default
- 2.18.12.1.1.3. AllowAmbiguousTypes
- 2.18.12.1.1.4. ApplicativeDo
- 2.18.12.1.1.5. ConstrainedClassMethods
- 2.18.12.1.1.6. CPP
- 2.18.12.1.1.7. DeriveFunctor
- 2.18.12.1.1.8. ExplicitForAll
- 2.18.12.1.1.9. FlexibleContexts
- 2.18.12.1.1.10. FlexibleInstances
- 2.18.12.1.1.11. GeneralizedNewtypeDeriving
- 2.18.12.1.1.12. ImplicitParams
- 2.18.12.1.1.13. LambdaCase
- 2.18.12.1.1.14. MultiParamTypeClasses
- 2.18.12.1.1.15. MultiWayIf
- 2.18.12.1.1.16. OverloadedStrings
- 2.18.12.1.1.17. PartialTypeSignatures
- 2.18.12.1.1.18. RankNTypes
- 2.18.12.1.1.19. ScopedTypeVariables
- 2.18.12.1.1.20. TupleSections
- 2.18.12.1.1.21. TypeApplications
- 2.18.12.1.1.22. TypeSynonymInstances
- 2.18.12.1.1.23. UndecidableInstances
- 2.18.12.1.1.24. ViewPatterns
- 2.18.12.1.1.25. DatatypeContexts
-
2.18.12.1.1.26. StandaloneKindSignatures
- 2.18.12.1.1.27. PartialTypeSignatures
- 2.18.12.1.1.28. TypeOperators
- 2.18.12.1.2. How to make a GHC LANGUAGE extension
-
2.19. Computer science
-
2.19.1. Guerrilla patch
- 2.19.2. Interface
- 2.19.3. Module
-
2.19.4. Scope
- 2.19.5. Shadowing
- 2.19.6. Syntatic sugar
-
2.19.7. System F
- 2.19.8. Tail call
- 2.19.9. Thunk
- 2.19.10. Application memory
-
2.19.11. Turing machine
- 2.19.12. REPL
-
2.19.13. Domain specific language
-
2.19.14. Data structure
-
2.20. Graph theory
-
2.20.1. Successor
-
2.20.2. Predecessor
-
2.20.3. Degree
-
2.20.4. Adjacency matrix
-
2.20.5. Strongly connected
- 2.21. Tagless-final
-
2.22. Prefix notation
- 3. Citation
-
4. Good code
- 4.1. Good: Type aliasing
- 4.2. Good: Type wideness
- 4.3. Good: Print
- 4.4. Good: Fold
- 4.5. Good: Computation model
- 4.6. Good: Make bottoms only local
- 4.7. Good: Newtype wrap is ideally transparent for compiler and does not change performance
- 4.8. Good: Instances of types/type classes must go with code you write
- 4.9. Good: Functions can be abstracted as arguments
- 4.10. Good: Infix operators can be bind to arguments
- 4.11. Good: Arbitrary
- 4.12. Good: Principle of Separation of concerns
- 4.13. Good: Function composition
-
4.14. Good: Point-free
- 4.15. Good: Functor application
- 4.16. Good: Parameter order
- 4.17. Good: Applicative monoid
-
4.18. Good: Creative process
- 4.18.1. Pick phylosophy principles one to three the more - the harder the implementation
- 4.18.2. Draw the most blurred representation
- 4.18.3. Deduce abstractions and write remotely what they are
-
4.18.4. Model of computation
- 4.18.5. Create
- 4.19. Good: About operators
(<$ ) ( **>) (<* ) (>> )
- 4.20. Good: About functions like {mapM, sequence}_
-
4.21. Good: Guideliles
-
4.21.1. Wiki.haskell
-
4.21.1.1. Documentation
- 4.21.1.1.1. Comments write in application terms, not technical.
- 4.21.1.1.2. Tell what code needs to do not how it does.
-
4.21.1.2. Haddoc
-
4.21.1.3. Code
- 4.21.1.3.1. Try to stay closer to portable (Haskell98) code
- 4.21.1.3.2. Try make lines no longer 80 chars
- 4.21.1.3.3. Last char in file should be newline
- 4.21.1.3.4. Symbolic infix identifiers is only library writer right
- 4.21.1.3.5. Every function does one thing.
- 4.22. Good: Use Typed holes to progress the code
- 4.23. Good: Haskell allows infinite terms but not infinite types
- 4.24. Good: Use type sysnonims to differ the information
- 4.25. Good: Use
Control.Monad.Except instead of Control.Monad.Error
-
4.26. Good: Monad OR Applicative
-
- 4.26.0.1. Start writing monad using 'return', 'ap', 'liftM', 'liftM2', '>>' instead of 'do','>>='
- 4.26.0.2. Basic case when Applicative can be used
- 4.26.0.3. Applicative block vs Monad block
- 4.27. Good: Linear type
- 4.28. Good: Exception vs Error
- 4.29. Good: Let vs. Where
- 4.30. Good: RankNTypes
- 4.31. Good: Handling orphan instance
- 4.32. Good: Smart constructor
- 4.33. Good: Thin category
- 4.34. Good: Recursion
- 4.35. Good: Monoid
- 4.36. Good: Free monad
- 4.37. Good: Use mostly where clauses
- 4.38. Good: Where clause is in a scope with function parameters
- 4.39. Good: Strong preference towards pattern matching over {head, tail, etc.} functions
- 4.40. Good: Patternmatching is possible on monadic bind in do
- 4.41. Good: Applicative vs Monad
- 4.42. Good: StateT, ReaderT, WriterT
- 4.43. Good: Working with MonadTrans and lift
- 4.44. Good: Don't mix Where and Let
- 4.45. Good: Where vs. Let
- 4.46. Good: The proper nature algorithm that models behaviour of many objects is computation heavy
- 4.47. Good: In Haskell parameters bound by lambda declaration instantiate to only one concrete type
- 4.48. Good: Instance is a good structure to drew a type line
- 4.49. Good: MTL vs. Transformers
-
5. Bad code
-
6. Useful functions to remember
-
7. Tool
- 7.1. ghc-pkg
-
7.2. Integration of NixOS/Nix with Haskell IDE Engine (HIE) and Emacs (Spacemacs)
- 7.2.1. 1. Install the Cachix
-
7.2.2. 2. Installation of HIE
- 7.2.2.1. 2.1. Provide cached builds
- 7.2.2.2. 2.2.a. Installation on NixOS distribution:
- 7.2.2.3. 2.2.b. Installation with Nix package manager:
- 7.2.3. 3. Emacs (Spacemacs) configuration:
- 7.2.4. 4. Open the Haskell file from a project
- 7.2.5. 5. Be pleased writing code
- 7.2.6. 6. (optional) Debugging
-
7.3. GHC
-
7.4. GHCI
- 7.5. GHCID
- 7.6. runghc
-
7.7. Packaging
- 7.7.1. Cabal
-
7.7.2. Nix
- 7.7.3. cabal2nix
- 7.7.4. hackage2nix
- 7.7.5. cabal2spec - Cabal to RPM
- 7.7.6. nix-tools
- 7.7.7. haskell.nix
- 7.8. Emacs/Spacemacs
- 7.9. Continuous integration platrorms (CIs) for Open Source Haskell projets
-
8. Library
-
8.1. Exceptions
- 8.1.1. Exceptions - optionally pure extensible exceptions that are compatible with the mtl
- 8.1.2. Safe-exceptions - safe, simple API equivalent to the underlying implementation in terms of power, encourages best practices minimizing the chances of getting the exception handling wrong.
- 8.1.3. Enclosed-exceptions - capture exceptions from the enclosed computation, while reacting to asynchronous exceptions aimed at the calling thread.
-
8.2. Memory management
- 8.3. Parsers - megaparsec
-
8.4. CLIs - optparse-applicative
- 8.4.1. Modifiers {Attributes}
- 8.4.2. Builders
- 8.4.3. Parsers
- 8.4.4. Composing and more complex parsers
- 8.4.5. Error handling
- 8.4.6. Shell expansion
- 8.5. HTML - Lucid
- 8.6. Web applications - Servant
-
8.7. IO libraries
- 8.7.1. Conduit - practical, monolythic, guarantees termination return
- 8.7.2. Pipes + Pipes Parse - modular, more primitive, theoretically driven
- 8.8. JSON - aeson
- 8.9. Backpack
-
8.10. DSL
-
9. Draft
-
9.1. Exception handling
- 9.1.1. Ideal catching
- 9.1.2.
Control.Exception.Safe main sets of functions
- 9.1.3. Clean-up of actions/resources
- 9.1.4. Ideal model
- 9.1.5. Universal exception type
- 9.1.6. Individual exception types
- 9.1.7. Abstract exception type
- 9.1.8. Composit approach
- 9.1.9. The changes in GHC 8.8
- 9.1.10. Diversity in exceptions
- 9.1.11. Exception handling strategies
- 9.1.12. Asynchronous exception
- 9.1.13. Monadic Error handling
- 9.2. Constraints
- 9.3. Monad transformers and their type classes
- 9.4. Layering monad transformers
-
9.5. Hoogle
- 9.5.1. Search
-
9.5.2. Scope
- 9.5.2.1. Default
- 9.5.2.2. Hierarchical module name system (from big letter):
- 9.5.2.3. Packages (lower case):
-
9.6. ST-Trick monad
-
9.7. Either
- 9.8. Inverse
- 9.9. Inversion
- 9.10. Inverse function
- 9.11. Inverse morphism
- 9.12. Partial inverse
-
9.13. PatternSynonyms
-
9.14. GHC debug keys
-
9.15. GHC optimize keys
-
9.16. Computational trinitarianism
-
9.17. Techniques functional programming deals with the state
- 9.18. Functions
-
9.19. Void
-
9.20. Intuitionistic logic
-
9.21. Principle of explosion
- 9.22. Universal property
- 9.23. Yoneda lemma
- 9.24. Monoidal category, functoriality of ADTs, Profunctors
- 9.25. Const functor
- 9.26. Arrow in Haskell
- 9.27. Contravariant functor
- 9.28. Profunctor
-
9.29. Coerce
-
9.30. Universal/Existential quantification
- 9.31. Propagator
- 9.32. Code technics
-
9.33. Algorithm of the Hackage package release
- 9.33.1. Form Git{Hub,Lab} pre-release
- 9.33.2. Create git branch
release x.x.x.x+1
- 9.33.3. Open-up
git diff <lastVer>..HEAD on one side of the screen
- 9.33.4. Open
CHANGELOG.md on the other side of the screen
-
9.33.5. Walk through diff and populate CHANGELOG.md
-
9.33.5.1. Populate according to PVP
- 9.33.5.1.1. Major breaking changes
- 9.33.5.1.2. (optional) API additions of functionality
- 9.33.5.1.3. (optional) Other changes in the project, news
- 9.33.6. Check
cabal sdist build passes
- 9.33.7. Think what new files can/should be included in
.cabal extra-source-files
- 9.33.8. Update
.cabal version:
- 9.33.9. Add a
git tag <v>
- 9.33.10.
git push --tags
- 9.33.11. (optional) (Remove git tag)
- 9.33.12. Make a
cabal sdist
- 9.33.13. Upload package candidate to Hackage
- 9.33.14. (careful) Be fully ready when you upload package release to Hackage, since upload is idempotant
-
9.33.15. (optional) If docs not posted on Hackage
- 9.34. Is power set functor is a bifunctor
-
9.35. IO
-
9.35.1. Base IO Data types
- 9.35.1.1. IO a
- 9.35.1.2. FilePath
- 9.35.1.3. Handle
- 9.35.1.4. HandlePosn
- 9.35.1.5. Standart handlers
- 9.35.1.6. IOMode
- 9.35.1.7. File locking
- 9.35.1.8. Opening files
- 9.35.1.9. hClose
- 9.35.1.10. Special cases
- 9.35.1.11. Handle operation
- 9.35.1.12. BufferMode
- 9.35.1.13. Buffering operation
- 9.35.2. Cabal
Paths_pkgname
-
9.36. Lazy
- 9.37. Traversable
-
9.38. Fixed point
- 9.39.
- 9.40. Conway's law
- 9.41. F-algebra
-
10. Reference
-
10.1. History
-
10.1.1. Functor-Applicative-Monad Proposal
-
10.1.2. Haskell 98
- 10.1.3. "Great moments in Haskell history" (by Type Classes) - History of Haskell
-
10.2. Resources
- 10.2.1. "State of the Haskell ecosystem"
- 10.2.2. "Haskell performance" tools, processes, comparisons, data, information, guides
- 10.2.3. data Haskell - (2017) annotated links to data science & machine learning libraries, overviews and benchmarks of libraries
- 10.3. Literature
-
10.4. Haskell Package Versioning Policy
- 11. Giving back
_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:
-
Algebra - a set with its algebraic structure.
-
Abstract algebra - the study of number systems and operations within them.
-
Algebra - vector space over a field with a multiplication.
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
✓
Small Category
✓
✓
Groupoid
✓
✓
✓
Magma
✓
Quasigroup
✓
✓
Loop
✓
✓
✓
Semigroup
✓
✓
Inverse Semigroup
✓
✓
✓
Monoid
✓
✓
✓
Group
✓
✓
✓
✓
Abelian group
✓
✓
✓
✓
✓
Non-unital ring (rng)
✓ + ×
✓ + ×
✓ +
✓ +
✓ +
✓
Semiring (rig)
✓ + ×
✓ + ×
✓ + ×
✓ ×
✓ +
✓
Ring
✓ + ×
✓ + ×
✓ + ×
✓ + ×
✓ +
✓
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
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.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.2 Monoid properties
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.