Skip to content

Instantly share code, notes, and snippets.

View barambani's full-sized avatar

Filippo Mariotti barambani

View GitHub Profile
@barambani
barambani / kinds.md
Created June 11, 2018 15:05 — forked from 5310/kinds.md
Kind Polymorphism in Haskell #article

So we have all these types like Int, Float, String, Map String Int, [Maybe String], etc. What do all these types have in common? Well, essentially, they're "normal" types where we can make a value for them. Just as values have types, types have "kinds". In this case, just as 4 : Int, Int : *, and just as "Hello" : String, String : *. That is to say, all these normal types (the types of plain old values) have kind *.

Now, in OCaml, you have type parametricity, but only over types of kind *. Let's give an example of a type that's not of kind *.

Map : * -> * -> *

We apply this "type constructor" (which is a kind of "type function", just like constructors are a kind of function) to the type Int : *.

Map Int : * -> *

@barambani
barambani / Day1.scala
Last active December 31, 2019 22:33
Applied Functional Programming In Scala Day 1
object Functions {
/**
* Functions
* - Total (every element in the domain must have a representation in the co-domain)
* - Deterministic (give always the same result for the same input)
* - Not side effecting (the only result of the function is the mapped value)
*/
/**

Advanced Functional Programming with Scala - Notes

Copyright © 2016-2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@barambani
barambani / MyVimrc
Last active June 29, 2020 18:55
My current .vimrc file
" Initialize plugin system
call plug#begin('~/.vim/plugged')
Plug 'rizzatti/dash.vim'
Plug 'derekwyatt/vim-scala'
Plug 'vim-syntastic/syntastic'
Plug 'kien/ctrlp.vim'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'ervandew/supertab'