View gist:10e8a999eabcc9cb566c087978f5c3ac
bash-3.2$ command -v sw_vers && sw_vers # OS X only
/usr/bin/sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.2
BuildVersion: 17C205
bash-3.2$ command -v uname && uname -a # Kernel version
/usr/bin/uname
Darwin Maximilians-MBP 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
bash-3.2$ command -v stack && stack --version
/usr/local/bin/stack
View gist:a861cdacbeedf6c11b5488b0ff4f50e0
maximiliantagher@Maximilians-MBP ~/D/t/citext> bash
bash-3.2$ command -v sw_vers && sw_vers # OS X only
/usr/bin/sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.2
BuildVersion: 17C88
bash-3.2$ command -v uname && uname -a # Kernel version
/usr/bin/uname
Darwin Maximilians-MBP 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
bash-3.2$ command -v stack && stack --version
View gist:cb80301f9061243a095b8e2edafa31ec
bash-3.2$ command -v sw_vers && sw_vers # OS X only
/usr/bin/sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.1
BuildVersion: 17B1003
bash-3.2$ command -v uname && uname -a # Kernel version
/usr/bin/uname
Darwin Maximilians-MBP 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
bash-3.2$ command -v stack && stack --version
/usr/local/bin/stack
View gist:9e757f2da60ac53b45bb06b2b097d86b
-- First enable citext in psql: CREATE EXTENSION IF NOT EXISTS citext;
-- Create Model/CustomTypes.hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Model.CustomTypes where
View gist:56e2efe78312ebc62aa4e7c319da16a2
maximiliantagher@Maximilians-MBP ~/D/t/stack-issue> stack ghci --verbose
Version 1.5.1, Git revision 600c1f01435a10d127938709556c1682ecfd694e (4861 commits) x86_64 hpack-0.17.1
2017-11-16 14:30:58.199868: [debug] Checking for project config at: /Users/maximiliantagher/Documents/tmp/stack-issue/stack.yaml
@(Stack/Config.hs:974:9)
2017-11-16 14:30:58.200754: [debug] Loading project config file stack.yaml
@(Stack/Config.hs:999:13)
2017-11-16 14:30:58.201947: [debug] Trying to decode /Users/maximiliantagher/.stack/build-plan-cache/x86_64-osx/lts-9.13.cache
@(Data/Store/VersionTagged.hs:72:5)
2017-11-16 14:30:58.215946: [debug] Success decoding /Users/maximiliantagher/.stack/build-plan-cache/x86_64-osx/lts-9.13.cache
@(Data/Store/VersionTagged.hs:76:13)
View keybase.md

Keybase proof

I hereby claim:

  • I am maxgabriel on github.
  • I am maxgabriel (https://keybase.io/maxgabriel) on keybase.
  • I have a public key ASDGLrNkRBb6XgmcswXZXyvv1blRELY3g1CDWmF8BFHupwo

To claim this, I am signing this object:

View molecules.rb
#!/usr/bin/env ruby
require 'csv'
require 'set'
## HA (hyaluronic acid) molecule merging script
## Written by Max Tagher, licensed to the Public Domain under Creative Commons Zero 1.0
### Overview
# This script runs a simulation of HA molecules merging with one another.
View main.hs
{-# LANGUAGE MultiWayIf #-}
module Main where
import Data.Time
import System.Random
import Control.Reaper
import Control.Concurrent
import Control.Monad
import Data.IORef
View ekg-yesod.md

Monitoring a Yesod app with EKG

Monitoring is critical to a well-functioning production system. OS-level metrics like CPU load and RAM usage are a good start, but you'll eventually want to record application-level metrics like how long it's taking you to service each HTTP request, or how much time is spent in garbage collection. Once tracked, this data can be used by humans and machines (like monitoring systems) to gain insight into how your app is running.

In this post I'll show how you can use EKG, a popular Haskell metrics library, to add application-level metrics to your Yesod app.

A Brief Overview of EKG Metric Types

EKG allows reporting four different types of metrics from your app:

View ekgjson.json
{
"myapp":{
"home_requests":{
"type":"c",
"val":0
}
},
"ekg":{
"server_timestamp_ms":{
"type":"c",