Skip to content

Instantly share code, notes, and snippets.

View BalmungSan's full-sized avatar
👨‍🏫
Learning & Teaching

Luis Miguel Mejía Suárez BalmungSan

👨‍🏫
Learning & Teaching
View GitHub Profile
@Daenyth
Daenyth / monad-li-seme.md
Last active May 11, 2023 15:12
What's a monad

"Monad" is a word that describes a set of behaviors

In scala, we use the Monad[Foo] typeclass from cats to define instances of this behavior.

The essence of its behavior is the ability to describe a series of computations, where one computation depends on the result of the computation that came before it.

For example, Monad[Option] shows that the Option[A] data type can be used to describe computations of A which may result in no value.

Serverless Concept

This document describes the general outcome we want for users as well as a few ideas on how we should do this. It shouldn't be considered prescriptive or precise though; if we come up with better ideas along the way, we should do them instead!

Onboarding

Users should be able to run something like the following:

$ sbt new typelevel/serverless.g8 --branch aws/http

Understanding Comparative Benchmarks

I'm going to do something that I don't normally do, which is to say I'm going to talk about comparative benchmarks. In general, I try to confine performance discussion to absolute metrics as much as possible, or comparisons to other well-defined neutral reference points. This is precisely why Cats Effect's readme mentions a comparison to a fixed thread pool, rather doing comparisons with other asynchronous runtimes like Akka or ZIO. Comparisons in general devolve very quickly into emotional marketing.

But, just once, today we're going to talk about the emotional marketing. In particular, we're going to look at Cats Effect 3 and ZIO 2. Now, for context, as of this writing ZIO 2 has released their first milestone; they have not released a final 2.0 version. This implies straight off the bat that we're comparing apples to oranges a bit, since Cats Effect 3 has been out and in production for months. However, there has been a post going around which cites various compar

@Daenyth
Daenyth / scala-aws.md
Created October 10, 2020 14:40
Scala AWS library index

Notes

There's a lot of libraries with overlapping support. This tries to index the ones I've seen.

I only care about / list the ones that support cats-effect/fs2 in some way or another.

I'll list some project status:

  • Dead = fully abandoned or archived
  • Inactive = no changes for over a year (as of oct 2020)
@BalmungSan
BalmungSan / why-fp.md
Last active December 31, 2022 04:54
Why Functional Programming?

Why Functional Programming?

Probably not the most poetic nor academic or well written phrase, but let me express in plain English why I end up choosing Functional Programming.

Over my time coding (which I have to clarify that has been short) I have learned two important things about code.
(mostly from the experience of many more veteran colleagues)

  1. The best line of code is the one that is not written. Why? Because, every single line of code that you write is instant technical debt. No matter, how well done it is, how well designed it was, how much of 1000x programmer you are, all the code is debt. All the code will become obsolete at some point in time, all the code has to be refactored.
@nrktkt
nrktkt / ExampleSpec.scala
Last active February 27, 2020 07:34
AWS unit tests with localstack and scalatest
import cloud.localstack.docker.annotation.LocalstackDockerProperties
import cloud.localstack.TestUtils
import org.scalatest.{BeforeAndAfterEach, FlatSpec}
import ...LocalstackSpec
@LocalstackDockerProperties(services = Array("s3"))
class ExampleSpec
extends FlatSpec
with BeforeAndAfterEach
with LocalStackSpec {
object App {
trait MyTrait
object MyTrait {
def materialize[A <: MyTrait](implicit m: A): A = m
}
implicit val m/*: MyTrait*/ /*: (MyTrait {
/*implicit*/ val x: Int
})*/ = new MyTrait {
import shapeless.{::, HNil, Poly1, poly}
object App {
implicit object p extends Poly1 {
implicit val cse: Case.Aux[Int, String] = at(_.toString)
}
// implicit val p = new Poly1 {
// implicit val cse: Case.Aux[Int, String] = at(_.toString)
// }
@abeln
abeln / scala-explicit-nulls.md
Last active December 18, 2020 13:57
Scala with Explicit Nulls
@BalmungSan
BalmungSan / Polymorphism.md
Last active January 7, 2024 18:41
Polymorphism in Scala.

Polymorphism in Scala.

This document aims to show and compare three alternatives for achieving polymorphism in Scala.

  • Subtyping, common in object-oriented languages like Java.
  • Duck typing, common in dynamically typed languages like Python.
  • Typeclasses, common in functional languages like Haskell.

Additionally, when implementing the typeclass pattern in Scala,