This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<BuildTimestamp>$([System.DateTime]::UtcNow.ToString("yyyyMMddHHmmss"))</BuildTimestamp> | |
<BuildMachine>$([System.Environment]::MachineName)</BuildMachine> | |
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(BuildType)' == ''"> | |
<BuildType>Dev</BuildType> | |
</PropertyGroup> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IConstraint<T> | |
{ | |
bool Satisfies(T value); | |
} | |
public class Constrained<T, Constraint> | |
where Constraint : IConstraint<T>, new() | |
{ | |
public static bool TryCreate(T val, out Constrained<T, Constraint> result) | |
{ | |
var c = new Constraint(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
module Lib | |
(StringValued (getValue), | |
SqlString, | |
sqlEncode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Option | |
{ | |
public static Option<T> Some<T>(T item) | |
=> new Option<T>(item); | |
public static Option<T> None<T>() | |
=> new Option<T>(); | |
} | |
public struct Option<T> | |
{ | |
private readonly T value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct EmailAddress | |
{ | |
private EmailAddress(string value) | |
{ | |
Value = value; | |
} | |
public string Value { get; } | |
public static bool TryParse(string emailAddress, out EmailAddress result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IStringValued | |
{ | |
string Value { get; } | |
} | |
public struct BareString : IStringValued | |
{ | |
public BareString(string value) | |
{ | |
Value = value; | |
} |