Skip to content

Instantly share code, notes, and snippets.

View markhibberd's full-sized avatar

markhibberd markhibberd

View GitHub Profile
@markhibberd
markhibberd / characters.md
Last active January 14, 2021 18:32
Haskell Character Data

Overview

There are lots of representations for strings. In most languages they pick one set of tradeoffs and run with it. In haskell the "default" implementation (at least the one in the prelude) is a pretty bad choice, but unlike most other languages (really) good implementations exist for pretty much every way you can twist these things. This can be a good thing, but it also leads to confusion, and frustration to find the right types and how to convert them.

Types

@markhibberd
markhibberd / postmortem.md
Created June 21, 2018 01:47 — forked from mlafeldt/postmortem.md
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym

Installation

FreeBSD

portmaster irc/irssi
portmaster irc/irssi-xmpp

OS X

brew install irssi

@markhibberd
markhibberd / .projectile
Created August 25, 2017 01:36
Haskell projectile file.
-/*/dist
-/lib
-/*/.cabal-sandbox
-/dist
-/.cabal-sandbox
@markhibberd
markhibberd / lens.hs
Last active March 19, 2017 16:28
haskell for lenses
data Lens a b = Lens {
get :: a -> b
, set :: b -> a -> a
}
type Lens' a b =
forall f. Functor f => (b -> f b) -> a -> f a
newtype Identity a =
Identity { runIdentity :: a }
```
/------ A -|
[submit batch] -------- B -|--[success-of-all-in-batch]-- D (which submits new batch to hydra to run next step)
\------ C -|
```
@markhibberd
markhibberd / argonaut.scala
Created January 3, 2014 03:05
argonaut union type example
package argonaut.example
import argonaut._, Argonaut._
import scalaz._, Scalaz._
object UnionExample extends {
sealed trait Thing
final case class One(n: String, i: Int) extends Thing
final case class Two(n: String) extends Thing
@markhibberd
markhibberd / .profile
Created September 23, 2016 08:09 — 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
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
module Boris.Http.TH (
embed
) where
import qualified Data.Text as T
scala> class X
defined class X
scala> class Y extends X
defined class Y
scala> def some[A](f: A)(implicit ev: A => X): X = ev(f)
some: [A](f: A)(implicit ev: A => X)X
scala> some(new X)