Skip to content

Instantly share code, notes, and snippets.

Explaining Miles's Magic

Miles Sabin recently opened a pull request fixing the infamous SI-2712. First off, this is remarkable and, if merged, will make everyone's life enormously easier. This is a bug that a lot of people hit often without even realizing it, and they just assume that either they did something wrong or the compiler is broken in some weird way. It is especially common for users of scalaz or cats.

But that's not what I wanted to write about. What I want to write about is the exact semantics of Miles's fix, because it does impose some very specific assumptions about the way that type constructors work, and understanding those assumptions is the key to getting the most of it his fix.

For starters, here is the sort of thing that SI-2712 affects:

def foo[F[_], A](fa: F[A]): String = fa.toString
@zedar
zedar / ApacheHadoopSpark_LZO.adoc
Last active April 24, 2024 14:33
Add LZO compression codecs to the Apache Hadoop and Spark

Add LZO compresssion codecs to the Apache Hadoop and Spark

LZO is a splittable compression format for files stored in Hadoop’s HDFS. It has valuable combination of speed and compression size. Thanks to hadoop-lzo the .lzo files could be splittable too.

  • Install lzo and lzop codes [OSX].

$ brew install lzo lzop
  • Find where the headers and libraries are installed

def graphql: Endpoint[Json] = {
post(
"graphql" ? (body :: authOptReader :: contentTypeReader :: imageOptReader :: queryReader :: variablesReader)
){ (body: String, authOpt: Option[TokenUUID], contentType: String, image: Option[FileUpload], query: Option[String], variables: Option[String]) =>
contentType.take("multipart/form-data".length) match {
case "multipart/form-data" => {
for {
auth <- getAuthorization(authOpt)
@Bekbolatov
Bekbolatov / tmux.md
Last active July 8, 2025 17:59
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@zchee
zchee / actionlist.vim
Last active July 30, 2025 15:26
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@worace
worace / SQLengine.markdown
Last active September 21, 2015 21:11
Possible Mod 4 short projects

SQL Engine

Remember our old buddy Sales Engine? It just won't die. The original clients from the sales engine project have returned, this time requesting more Business Intelligence features. Our original SalesEngine was starting to push the bounds of what we could do efficiently in pure ruby, so our new implementation is going to require some updated tech.

This time around we'll implement sales engine using a database with ActiveRecord. This will allow us to offload some of that complicated business logic where it belongs -- in a relational databse. But steel yourselves, since this new implementation will require writing some SQL.

  • Library/CLI only (no web ui?)
  • Spec harness?
  • New BI reqs?
@non
non / answer.md
Last active February 28, 2025 11:46
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@obfusk
obfusk / break.py
Last active July 11, 2025 11:12
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))