Skip to content

Instantly share code, notes, and snippets.

View marius-carp's full-sized avatar

Marius Carp marius-carp

  • Assist Software
  • Suceava
View GitHub Profile
@gvolpe
gvolpe / di-in-fp.md
Last active September 16, 2024 07:18
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.
@jroper
jroper / LazyBroadcastHub.scala
Created July 15, 2017 11:06
Akka streams LazyBroadcastHub - a broadcast hub that only keeps its source materialized as long as there are consumers
package streams.utils
import akka.NotUsed
import akka.stream._
import akka.stream.scaladsl.{BroadcastHub, Keep, RunnableGraph, Source}
import akka.stream.stage._
import scala.concurrent.duration.{Duration, FiniteDuration}
/**