Skip to content

Instantly share code, notes, and snippets.

View dwijnand's full-sized avatar

Dale Wijnand dwijnand

View GitHub Profile

The Cabal/Stack Disambiguation Guide

One of the most frequently asked Haskell beginner questions in recent years is:

"Stack or cabal?"

I will helpfully not answer this question. Instead I will hope to eliminate the confusion that many of the askers seem to have about the various different

@dwijnand
dwijnand / sbt-new
Created March 8, 2019 17:05 — forked from paulp/sbt-new
a less messy sbt new
#!/usr/bin/env bash
#
# Intercepting the output of 'sbt new' directly fails
# because it asks interactive questions so we can't process
# line by line. An apparent OSX-specific bug in egrep
# fails on lookbehind clauses so we use ag. Capturing
# the interactive output with script succeeds, but script
# uses \r\n to terminate lines so we can't match the
# filename with '.*' or we get
#
@dwijnand
dwijnand / .gitignore
Created November 7, 2018 09:21 — forked from jboner/OrderManagement.scala
Demo of an Event-driven Architecture in Akka and Scala. Show-casing Events-first DDD, Event Sourced Aggregates, Process Manager, etc.
project/
@dwijnand
dwijnand / build.sbt
Last active May 4, 2017 21:02 — forked from paulp/build.sbt
/** Your task is to reason your way to which compiler
* options which will be passed for each of
* 1) sbt root/compile
* 2) sbt p1/compile
*/
scalacOptions in Global += "-D1"
scalacOptions in ThisBuild += "-D0"
scalacOptions := Seq("-DSBT")
@dwijnand
dwijnand / .profile
Created October 19, 2016 23:53 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
// Quasiquoted excerpt
def cdef = q"""
class $ClassName[..$classTypeParams](..$primaryParams) extends ..$classParents {
..$primaryAccessors
def get = this
def isEmpty = ${quasi.isEmpty}
def copy(..$primaryWithDefaults) = $ObjectName(..$primaryNames)
@dwijnand
dwijnand / Task.scala
Last active January 6, 2016 11:29 — forked from shajra/Task.scala
Integration code between Scalaz and Scala standard concurrency libraries.
import scalaz.\/
import scalaz.concurrent.Task
import scala.concurrent.{ ExecutionContext, Future, Promise }
import scala.util.Try
class TaskCompat(private val T: Task.type) extends AnyVal {
def fromScala[A](future: Future[A])(implicit ec: ExecutionContext): Task[A] =
Task async (handlerConversion andThen future.onComplete)