Skip to content

Instantly share code, notes, and snippets.

View pptaszynski's full-sized avatar
🎯
Focusing

Paweł Ptaszyński pptaszynski

🎯
Focusing
View GitHub Profile

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 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
import language.higherKinds
trait Monad1[M[_]] {
def id[A](a: A): M[A]
def compose[A,B,C](f: A => M[B], g: B => M[C]): A => M[C]
def flatMap[A,B](ma: M[A], f: A => M[B]): M[B] = ???
def join[A](mma: M[M[A]]): M[A] = ???
val sqrt = math.sqrt _
val acos = math.acos _
val divTen = (x:Double) => x/10.0
sqrt(64.0)
divTen(8.0)
acos(0.8)
@jaceklaskowski
jaceklaskowski / Designing for API (with Swagger and Scala).md
Last active November 15, 2020 20:19
Designing for API (with Swagger and Scala)
@jaceklaskowski
jaceklaskowski / Rough Notes about CQRS and ES.md
Last active February 19, 2025 12:29
Rough Notes about CQRS and ES

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.