Skip to content

Instantly share code, notes, and snippets.

@JamesTryand
JamesTryand / DomainModel.cs
Created May 24, 2012 06:47
simplecqrs & simple.testing together
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleCqrs.Commanding;
using SimpleCqrs.Domain;
using SimpleCqrs.Eventing;
namespace ConsoleApplication4
{
@JamesTryand
JamesTryand / .gitconfig
Created June 8, 2012 20:51 — forked from isaacs/.gitconfig
These are my shortcuts for git.
# A bunch of the stuff above relies on this, especially the aliases.
[user]
# you probably want to change this bit.
name = isaacs
email = [email protected]
signingkey = 0x6C481CF6
[alias]
ci = commit
st = status
br = branch
@JamesTryand
JamesTryand / SpecificationFixture.cs
Created July 21, 2012 19:23 — forked from yevhen/SpecificationFixture.cs
NUnit support for Greg Young's Simple.Testing "framework"
[TestFixture]
public class SpecificationFixture
{
[Test, TestCaseSource("GetSpecificationTestCases")]
public void Verify(SpecificationToRun spec)
{
var runner = new SpecificationRunner();
RunResult result = runner.RunSpecifciation(spec);
if (result.Passed)
@JamesTryand
JamesTryand / eventstoretests.cs
Created November 5, 2012 11:07
Quick Eventstore Tests
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Some.Infrastructure.Domain;
//using grensesnitt.Framework;
//using NUnit.Framework;
using Simple.Testing.ClientFramework;
namespace Some.Infrastructure.Tests
@JamesTryand
JamesTryand / eventstoretests1.cs
Created November 5, 2012 11:19
Simple.Testing with TransformedSpecification for testing against events.
namespace EventsUnitTests
{
public class SimpleReadSideTestWithCustomPriorEvents
{
private Guid AggregateId;
public Specification Test()
{
@JamesTryand
JamesTryand / Get-GroupMailAddresses.ps1
Created November 20, 2012 14:43
Gets the email addresses from a Active Directory Group(s)
function Get-GroupMailAddresses {
PARAM([string[]]$GroupName)
BEGIN {
$DSGroupNameBasis = { PARAM([string]$Name) PROCESS { "(&(groupType=-2147483646)(name=$Name))" } }
}
PROCESS {
(new-object DirectoryServices.DirectorySearcher( & $DSGroupNameBasis -Name $GroupName )).
FindAll().
Properties['member'] |
@JamesTryand
JamesTryand / ObservableBus.cs
Created November 20, 2012 18:48
Observable Bus
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infrastructure.Domain;
using System.Data.SqlClient;
using System.Reactive.Subjects;
using System.Reactive.Linq;
namespace Infrastructure.ScratchDomain
using System;
using System.IO;
using MsgPack.Serialization;
using ZeroMQ_MessagePack_Testbed.Models;
using ZMQ;
namespace ZeroMQ_MessagePack_Testbed
{
class Program
{

The Indexed State Monad in Haskell, Scala, and C#

Have you ever had to write code that made a complex series of succesive modifications to a single piece of mutable state? (Almost certainly yes.)

Did you ever wish you could make the compiler tell you if a particular operation on the state was illegal at a given point in the modifications? (If you're a fan of static typing, probably yes.)

If that's the case, the indexed state monad can help!

Motivation

namespace PKI
{
class Results : IEquatable<Results>
{
internal static readonly Results NotFound = new Results
{
Directory = "",
KeyName = ""
};