Skip to content

Instantly share code, notes, and snippets.

Jyri-Matti Lähteenmäki jyrimatti

Block or report user

Report or block jyrimatti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@etorreborre
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: http://www.chuusai.com/2011/06/09/scala-union-types-curry-howard/#comment-22
*/
/** 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
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.