Skip to content

Instantly share code, notes, and snippets.

View dperish's full-sized avatar

David Lee Perish dperish

View GitHub Profile
@dperish
dperish / HaskellListExtensions.cs
Created February 8, 2015 15:39
Haskell List Extensions for C#
/// <summary>
/// Extends IEnumerable Types to provide the basic
/// Haskell-like list manipulations
/// </summary>
public static class HaskellListExtensions {
/// <summary>
/// Returns the first item of a list
/// </summary>
public static T Head<T>(this IEnumerable<T> xs) {
@tomzorz
tomzorz / Enable_vt100_csharp.cs
Created April 12, 2017 19:26
Enable VT100 for the current console window from .NET Core
using System;
using System.Runtime.InteropServices;
namespace Vt100Test
{
public class Program
{
// ReSharper disable InconsistentNaming
/** Used by Flavor to mark a type in a readable way. */
export interface Flavoring<FlavorT> {
_type?: FlavorT;
}
/** Create a "flavored" version of a type. TypeScript will disallow mixing flavors, but will allow unflavored values of that type to be passed in where a flavored version is expected. This is a less restrictive form of branding. */
export type Flavor<T, FlavorT> = T & Flavoring<FlavorT>;
/** Used by Brand to mark a type in a readable way. */
export interface Branding<BrandT> {
_type: BrandT;