Skip to content

Instantly share code, notes, and snippets.

View jacobm's full-sized avatar

Jacob Mortensen jacobm

  • Copenhagen
  • 09:38 (UTC +02:00)
View GitHub Profile
@jacobm
jacobm / Free.fsx
Last active April 18, 2016 08:04
Free monad interpreter in F# (based on: http://programmers.stackexchange.com/a/242803/145941)
type DSL<'next> =
| Get of string * (string -> 'next)
| Set of string * string * 'next
| End
with static member fmap f = function
| Get (k, c) -> Get (k, f << c)
| Set (k, v, c) -> Set (k, v, f c)
| End -> End
type FreeDSL<'a> =