Skip to content

Instantly share code, notes, and snippets.

View erszcz's full-sized avatar

Radek Szymczyszyn erszcz

View GitHub Profile

This is my recommended path for learning Haskell.

Something to keep in mind: don't sweat the stuff you don't understand immediately. Just keep moving.

Primary course

http://www.seas.upenn.edu/~cis194/lectures.html Brent Yorgey's course is the best I've found so far and replaces both Yann Esposito's HF&H and the NICTA course. This course is particularly valuable as it will not only equip you to write Haskell but also help you understand parser combinators.

Exercises for practice

Current Syntax

Existing map specification syntax, as was introduced in 17.0, allows the following different syntaxes:

  • map() or #{}: the type of any map (of any size).

  • #{a => integer(), b => list()}

A map that may only contain keys a and b. If it contains a key a, then it must be mapped to an integer value. Analogously for b.

Current Syntax

Existing map specification syntax, as was introduced in 17.0, allows the following different syntaxes:

  • map() or #{}: the type of any map (of any size).

  • #{a => integer(), b => list()}

A map that may only contain keys a and b. If it contains a key a, then it must be mapped to an integer value. Analogously for b.

@HernanRivasAcosta
HernanRivasAcosta / gist:948983b72becbd0ab1ce
Last active September 20, 2016 07:45
Parse transform to add partial application to erlang
-module(pt).
-export([parse_transform/2]).
parse_transform(ASTIn, _Options) ->
format(ASTIn).
format({call, Line, {atom, _, FName}, FixedArgs} = Call) ->
case handle_partial_application(FName, Line) of
undefined ->
format_tuple(Call);
@Gankra
Gankra / gist:155234908dae0d984fe5
Created March 19, 2015 20:56
mutable singly-linked list
struct List<T> {
head: Option<Box<Node<T>>>
}
struct Node<T> {
elem: T,
next: Option<Box<Node<T>>>,
}
impl<T> List<T> {
@highlyunavailable
highlyunavailable / mod_admin_cluster
Created April 6, 2015 17:46
mod_admin_cluster.erl
-module(mod_admin_cluster).
-author('highlyunavailable@gmail.com').
-behaviour(gen_mod).
-export([
join_cluster_as_master/1,
join_cluster/1,
leave_cluster/0,
leave_cluster/1,
@nebuta
nebuta / reverse.purs
Last active January 9, 2018 16:53
PureScript string reverse test
-- Type PureScript code here and click 'Compile' ...
--
-- Or select an example from the list at the top right of the page
module Main where
foreign import reverse "function reverse(s) { return function() { return s.split('').reverse().join(''); }; }" :: String -> String
a :: String
a = reverse "Hello"
@jfarcand
jfarcand / ngrep_hack.md
Last active May 29, 2018 18:07
Fixing broken ngrep with OS X Mavericks

Migrating to OS X Mavericks breaks the ngrep utility. Doing:

sudo ngrep -d lo0 -q -W byline port 8080

stopped working where the process exits immediately. I didn't dig into the ngrep code, but was able to find a simple workaround by doing

sudo ngrep -q -W byline -d lo0 '' 'port 8080'

You can call that a lazy hack, but it work!

-module(task).
-export([async/1, async/3]).
-export([await/1, await/2, await/3]).
-opaque t() :: #{tpid := pid(), tref := reference()}.
-type await_opts() :: [kill].
-export_type([t/0]).
-export_type([await_opts/0]).