Skip to content

Instantly share code, notes, and snippets.

View mihaisoloi's full-sized avatar

Mihai Soloi mihaisoloi

  • Bucharest, Romania
View GitHub Profile
@calvinlfer
calvinlfer / README.md
Last active April 20, 2022 09:10
How to build a GraalVM native image packaged as a Docker image that can be deployed on AWS Lambda

A build process for GraalVM native images that can be deployed on AWS Lambda as Docker container images

Use zio-lambda to write your own Lambda function based on Scala and ZIO

  • Checkout the example project for inspiration
  • Make sure you enable the GraalVMNativeImagePlugin like the example project does and configure it with the appropriate flags to build the native image
  • You may most likely need to add some reflect configuration and this post from Inner Product shows a good way to include the configuration in the project so Graal native-image will find it

If you have graal native already installed with the correct libraries in place for linking then great, otherwise use one of the following Docker images tagged with graalvm

**NOTE

@kevinmeredith
kevinmeredith / _.md
Last active January 4, 2022 16:25
The Power of Referential Transparency

The Power of Referential Transparency

Acknowledgment

This post uses the excellent Ammonite REPL for Scala REPL.

Thank you, Li Haoyi, for building it!

About the Author

Cats Effect 3.0 Proposal

If you're someone for whom code speaks louder than words, here's a branch to ponder: https://github.com/typelevel/cats-effect/tree/ce3

The following is a proposal for Cats Effect 3, collaboratively devised over the last few months by several of the maintainers and contributors to the library. I will frequently use first-person in this document (because I'm lazy), which is posted under my name (ditto), but it really was a joint effort. As with any joint effort, there has definitely been some healthy debate about several of the concepts in this proposal. For reference, these are the things we're the least sure about:

  • Concurrent now takes two type parameters, and thus is somewhat less ergonomic
  • Region has been added, along with some complex associated machinery
    • One component of that machinery is the Safe.Case type
  • Several existing laws are retained (such as Sync being stack-safe)
@ljwagerfield
ljwagerfield / ProfilingMemoryUsageJVM.md
Last active February 19, 2019 16:33
Profiling Memory Usage (JVM)

Profiling Memory Usage of a Method (JVM)

Prerequisites:

  • YourKit

Steps:

  1. Add Thread.sleep(60000) to the START and END of the method you want to profile.
@Daenyth
Daenyth / Pull.md
Last active November 9, 2023 17:14
Designing an fs2 `Pull` from scratch

The problem

I have some data which has adjacent entries that I want to group together and perform actions on. I know roughly that fs2.Pull can be used to "step" through a stream and do more complicated logic than the built in combinators allow. I don't know how to write one though!

In the end we should have something like

def combineAdjacent[F[_], A](
 shouldCombine: (A, A) => Boolean,
package commons
import scala.concurrent.ExecutionContext
import akka.actor.ActorSystem
case class Contexts(val actorSystem: ActorSystem) {
import Contexts._
implicit val defaultCtx = DefaultExeCtx(play.api.libs.concurrent.Execution.defaultContext)
implicit val ctrlsCtx = CtrlExeCtx(defaultCtx.underlying)

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
@alexandru
alexandru / task-proposal.md
Last active April 1, 2018 14:57
Task: A diverging design from Future and Scalaz Task
object NumericOption {
implicit def numericOption[A](implicit N: Numeric[A]): Numeric[Option[A]] =
new Numeric[Option[A]] {
def fromInt(x: Int): Option[A] = Option(N.fromInt(x))
def negate(x: Option[A]): Option[A] = x.map(N.negate(_))
// Not sure whether these should return zero or throw an error...
def toDouble(x: Option[A]): Double = x.map(N.toDouble(_)).getOrElse(0)
def toFloat(x: Option[A]): Float = x.map(N.toFloat(_)).getOrElse(0)
def toInt(x: Option[A]): Int = x.map(N.toInt(_)).getOrElse(0)
@igstan
igstan / decluttered-australis-ui.png
Last active August 29, 2015 14:00
Decluttered UI in Firefox 29
decluttered-australis-ui.png