Skip to content

Instantly share code, notes, and snippets.

namespace Topshelf
[<AutoOpen>]
module Topshelf =
open System
open Topshelf.HostConfigurators
open Topshelf.Runtime
let configureTopShelf f =
// This F# dojo is directly inspired by the Digit Recognizer
// competition from Kaggle.com:
// http://www.kaggle.com/c/digit-recognizer
// The datasets below are simply shorter versions of
// the training dataset from Kaggle.
// 0. Load data files from the following location:
// http://brandewinder.blob.core.windows.net/public/digitssample.csv
// http://brandewinder.blob.core.windows.net/public/digitscheck.csv
namespace PKI
{
class Results : IEquatable<Results>
{
internal static readonly Results NotFound = new Results
{
Directory = "",
KeyName = ""
};

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

using System;
using System.IO;
using MsgPack.Serialization;
using ZeroMQ_MessagePack_Testbed.Models;
using ZMQ;
namespace ZeroMQ_MessagePack_Testbed
{
class Program
{
@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
@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 / 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 / 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 / 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)