Skip to content

Instantly share code, notes, and snippets.

View ecatmur's full-sized avatar
👻

Ed Catmur ecatmur

👻
  • Maven Securities
  • Chicago
View GitHub Profile
@ecatmur
ecatmur / gist:4683098
Last active December 12, 2015 00:19 — forked from lcapaldo/gist:2065956
State monad, with nary lift. Type construction is collapsed to allow inference.
#include <functional>
#include <utility>
#include <iostream>
namespace hask {
struct Unit {};
template<typename S, typename V> struct State {
std::function<std::pair<S, V>(S)> runState;
using state_type = S;
using value_type = V;