This resource is for my study on Functional Programming, Generic Programming, Typelevel Programming and Category Theory. I will be using Haskell and Scala/Scalaz and whatever else comes my way.
Quoting the great Brendan McAdams "I am by no means a Haskell/Scala/Scalaz/Cats expert. I'm a beginner that has made a lot of progress." which also applies to me I guess. So don't learn from me, but maybe, get inspired and go look at Functional Programming, Haskell, Scala, Scalaz, the typelevel project, Cats, Scala Hamsters, Shapeless and overall create happy and therefor easy to reason about composable functions that, when applied, are called programs.
(0'31 hr) A practical introduction to category theory - Daniela Sfregola
Normal Subgroups, Quotient groups and Congruence Relations - Steven Roman
Category Theory, The essence of interface-based design by Erik Meijer
London Haskell Group - Why Do Monads Matter? by Derek Wright
London Haskell Group - The Algebra of Algebraic Data Types by Chris Taylor
What is Category Theory? It is the abstract theory of functions, and because functions are everywhere and everywhere that functions are, there are categories. Maybe Category Theory should have been called Abstract Function Theory (AFT)!
The the notion of a category arose in order to define a functor. The notion of a functor arose to define natural transformations. The notion of natural transformations arose to define adjoints.
Note: The following is in context of programming and not mathematically correct, and should
We write our programs in a way is composable, split a huge problem in small problems, solve the small pieces seperately and compose the solutions to these problems into one bigger program. - Bartosz
In category theory, an object in a category corresponds to a type corresponds to a proposition. - Bartosz
There are different kinds of category, a Set is one kind of category in which 'objects' are sets, and arrows are functions that go from one set to another set. - Bartosz
In mathematics, specifically in category theory, the Yoneda lemma is an abstract result on functors of the type morphisms into a fixed object.
The two most important ideas in modern Functional programming are:
Data first: Functional programming is all about putting data first. First define what kinds of data we have in a problem domain and what kind of transformations we want on them. Then we are building up the data structures and the code to do the transformations.
Managing of side-effects: Functional programming is not (only) about pure funcions any more. Eventually programs will produce side-effects and side-effect management is a puzzle in many parts.
So its about data management and controlling side-effects.
Data is represented by Structure and Types are represented by functions.
Visual Studio Code a.k.a. 'Code' is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, OS X and Linux. Code is an open source source code editor developed by Microsoft. It comes with built-in support for JavaScript, TypeScript, Node.js, Markdown and git and has a rich ecosystem of extensions for other languages and runtimes that are available on the Visual Studio Code Marketplace.
Code can be installed using brew:
$ brew cask install visual-studio-code
After installation, the editor can be found with Spotlight by typing: code
.
Code has support for Haskell by means of Haskell extensions. These extensions can be installed in Code by typing (⌘+P) and pasting:
ext install language-haskell
You'll first have to install hlint
$ cabal install hlint
Cabal will install hlint to /Users/your-user-name/Library/Haskell/bin
.
Now install the hlint extension (⌘+P) and pasting:
ext install haskell-linter
Set the following (⌘+P) + settings.json:
{
"haskell.hlint.executablePath": "/Users/your-user-name/Library/Haskell/bin/hlint",
"haskell.hlint.run": "onType", // also: "onSave", "never"
"haskell.hlint.logLevel": "log"
}
Note: Please replace your-user-name with the directory name of your system.
HLint's hints can be configured (⌘+P) + settings.json:
{
"haskell.hlint.hints": ["Default", "Dollar", "Generalise"],
"haskell.hlint.ignore": ["Redundant do"],
}
Code has a build option (SHIFT+CMD+B), but this has to be configured (F1: Configure Task Runner), replace the code with the following:
{
"version": "0.1.0",
"command": "runghc",
"isShellCommand": true,
"args": ["${file}"],
"showOutput": "always"
}
You can now run a haskell file when opened, but note that you'll have to have main
in scope like so:
main :: IO ()
main = putStrLn "Hello World, this is Haskell!"
Set the following (⌘+P) + settings.json:
{
"editor.renderWhitespace": true,
"editor.insertSpaces": true
}
Set the following (⌘+P) + settings.json:
{
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
}
Code has support for Dart and can be installed by typing (⌘+P) and pasting:
ext install dart
https://inoio.de/blog/2014/07/20/type-class-101-monoid/