Skip to content

Instantly share code, notes, and snippets.

@dadhi
dadhi / Env.fsx
Created March 11, 2019 12:51
An F# toy example of Scala ZIO Environment
module EnvDemo
open System
open System.IO
[<Struct>]
type Nothing =
private
| Nothing
@eulerfx
eulerfx / EventSourcingMonoids.fs
Last active May 17, 2024 15:09
F# event-sourcing with monoids
type Monoid<'a> = {
unit : 'a
op : 'a -> 'a -> 'a
}
let endo<'a> =
{ unit = id
op = fun (f:'a -> 'a) (g:'a -> 'a) -> f << g }
@robashton
robashton / BloatedController.cs
Created June 13, 2011 16:32
Partially Refactored controller
public class ReducedController : Controller
{
private readonly IContainProducts productRepository;
private readonly ISearchForProducts productsIndex;
private readonly IContainCustomers customerRepository;
private readonly IShipProducts productShipper;
private readonly ICoordinateSales salesCatalog;
public ReducedController(
IContainProducts productRepository,