Skip to content

Instantly share code, notes, and snippets.

View fommil's full-sized avatar
😽
having a fantastic day not writing any scala

>>= fommil

😽
having a fantastic day not writing any scala
View GitHub Profile
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 22:48
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@eabait
eabait / charting.libraries.md
Last active July 13, 2017 04:34
Charting Libraries
@olvaffe
olvaffe / i3lock-wait-for-suspend
Created May 30, 2014 17:20
i3lock-wait-for-suspend
#!/bin/sh
DBUS_NAME="org.freedesktop.login1"
DBUS_PATH="/org/freedesktop/login1"
DBUS_INTERFACE="org.freedesktop.login1.Manager"
DBUS_SIGNAL="PrepareForSleep"
INHIBITOR_PIDS=
install_background_inhibitor() {
#!/bin/sh
set -x
DBUS_NAME="org.freedesktop.login1"
DBUS_PATH="/org/freedesktop/login1"
DBUS_INTERFACE="org.freedesktop.login1.Manager"
DBUS_SIGNAL="PrepareForSleep"
INHIBITOR_PID=
install_background_inhibitor() {
@matanox
matanox / build.sbt
Created October 23, 2015 13:08
multi-project sbt build definition, involving dependent compiler and sbt plugins
val integrationTest = taskKey[Unit]("Executes integration tests.")
lazy val root = (project in file(".")).aggregate(simpleGraph, compilerPluginUnitTestLib, compilerPluginn, canveSbtPlugin, sbtPluginTestLib).enablePlugins(CrossPerProjectPlugin).settings(
scalaVersion := "2.11.7",
crossScalaVersions := Seq("2.10.4", "2.11.7"),
publishArtifact := false, // no artifact to publish for the virtual root project
integrationTest := (run in Compile in sbtPluginTestLib).value // not working: need to bounty http://stackoverflow.com/questions/33291071/invoking-a-subprojects-main-with-a-custom-task
)
lazy val simpleGraph = (project in file("simpleGraph"))
~/software/tinkerpop/tinkerpop3$ bin/gremlin.sh
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.giraph
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> graph.io(graphson()).readGraph('data/tinkerpop-modern.json')
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@paulp
paulp / oddity.txt
Created January 11, 2016 22:22
Whitespace Oddity
WHITESPACE ODDITY
by Paul Phillips, in eternal admiration of David Bowie, RIP
Bound Ctrl to Major mode
Bound Ctrl to Major mode
Read inputrc and set extdebug on
Bound Ctrl to Major mode (Ten, Nine, Eight, Seven, Six)
Connecting readline, options on (Five, Four, Three)
Check the syntax, may terminfo be with you (Two, One, Exec)
@raulraja
raulraja / SearchService.scala
Created January 26, 2016 23:25
An example of refactoring nested login in the Ensime Search Service with `XorT`
import cats.data.Xor, cats.syntax.xor._, cats.data.XorT
//Some type aliases for semantic purposes
type IndexedSymbols = Iterable[(FileObject, List[FqnSymbol])]
type IndexingError = (String, Throwable)
type ProcessResult[A] = XorT[Future, IndexingError, A]

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