Skip to content

Instantly share code, notes, and snippets.


Jyri-Matti Lähteenmäki jyrimatti

View GitHub Profile
etorreborre / gist:3870064
Created Oct 11, 2012
Unboxed union types with a context bound
View gist:3870064
* this is an experiment to create unboxed union types with a phantom type and a context bound.
* All the good ideas come from @milessabin post, comments and links:
/** trait for anything that can be A or B */
trait Or[A, B] {
// a phantom type, there will be no instance of this type that we'll use
type l[T]
// an alias for l[t]
noidi / gist:3751951
Created Sep 19, 2012
Why functional programming matters to enterprise programmers
View gist:3751951

Why functional programming matters to enterprise programmers

tl;dr: Solving a very specific problem using FP tends to produce a very general solution that's applicable to a wide range of problems.

Let's start with some Java code that we'll simplify using functional programming.

class Department {
  Employee getYoungestEmployee() {
    if (employees.isEmpty()) return null;
You can’t perform that action at this time.