Skip to content

Instantly share code, notes, and snippets.

View spamegg1's full-sized avatar
:octocat:
perpetually dissatisfied

spamegg spamegg1

:octocat:
perpetually dissatisfied
View GitHub Profile
@kyouko-taiga
kyouko-taiga / main.md
Last active February 1, 2024 21:31
Generic programming with type classes

Generic programming with type classes

Generic programming is a discipline that encourages the construction of abstractions and the reuse of software component without loss of efficiency. Subtyping through inheritance can be adversary to this goal because it encourages type erasure, promising that efficiency is maintained thanks to dynamic dispatch. Sadly, this promise gets broken when generic data structures and algorithms depend on more than one generic receiver. In those instances, one must resort to generic parameters to preserve type information, introducing expensive annotation costs. This short article examine this problem and then discusses how type classes, an alternative approach to practice generic programming, can address many of the issues presented by subtyping through inheritance.

Disclaimer:

@bishabosha
bishabosha / loops.scala
Last active November 15, 2023 03:56
Scala break/continue zero-cost loop abstraction
//> using scala "3.3.0"
import scala.util.boundary, boundary.break
object Loops:
type ExitToken = Unit { type Exit }
type ContinueToken = Unit { type Continue }
type Exit = boundary.Label[ExitToken]

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

@amaalali
amaalali / Scala .gitignore
Last active November 30, 2023 08:25
My standard .gitignore for scala projects
bin/
# Scala/SBT specific
project/
target/
build/
# Scala-Cli build folder
.scala-build/
@francescofrontera
francescofrontera / Op.scala
Last active November 11, 2023 05:22
Apply Aux pattern through Shapeless
import shapeless._, shapeless.ops.hlist._, shapeless.labelled.FieldType
trait Op[A] extends DepFn1[A]
trait LowPriority {
implicit def identity[A]: Op.Aux[A, A] = Op.createInstance(i => i)
}
object Op extends LowPriority {
type Aux[A, OUT0] = Op[A] { type Out = OUT0 }
@olets
olets / zsh-plugin-manager-plugin-installation-procedures.md
Last active May 18, 2024 21:40
zsh plugin manager cross-reference

Instructions for installing zsh plugins, for a variety of plugin managers

  • antibody: Add <owner>/<repo> to your plugins file. If you use static loading update the sh.

  • Antigen: Add antigen bundle <owner>/<repo> to your .zshrc.

  • Oh-My-Zsh:

    • Clone to OMZ's plugins' directory:
@jdegoes
jdegoes / fpmax.scala
Created July 13, 2018 03:18
FP to the Max — Code Examples
package fpmax
import scala.util.Try
import scala.io.StdIn.readLine
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()
@lregnier
lregnier / scala-with-style-by-martin-odersky.md
Last active March 16, 2023 21:41
Scala with Style, by Martin Odersky
@lattner
lattner / TaskConcurrencyManifesto.md
Last active June 19, 2024 13:41
Swift Concurrency Manifesto

MTH 325 Learning Targets

Proof

  • P.1: I can set up a framework of assumptions and conclusions for proofs using direct proof, proof by contraposition, and proof by contradiction.
  • P.2: I can identify the predicate being used in a proof by mathematical induction and use it to set up a framework of assumptions and conclusions for an induction proof.
  • P.3: I can identify the parts of a proof, including the technique used and the assumptions being made.
  • P.4: I can perform a critical analysis of a written proof and provide a detailed explanation of the steps used in the proof.

Graphs