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
type LF = (Argument, State) => (State, Result) | |
case class _then(f : LF) | |
case class _else(f : LF) | |
def _if (ifFunc: LF) (thenFunc: _then) (elseFunc: _else) : LF = | |
(a, state) => ifFunc(a, state) match { | |
case (_, Accepted) => thenFunc.f(a, state) | |
case _ => elseFunc.f(a, state) | |
} |
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 class Program | |
{ | |
public void Main() | |
{ | |
var solution = new Directory | |
{ | |
["global.json"] = new JObject | |
{ | |
["projects"] = new JArray { "src", "test" } | |
}, |
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
[<AutoOpen>] | |
module SuccessOrFailure = | |
type SuccessOrFailure<'a> = | |
| Success of 'a | |
| Failure of exn | |
let point v = Success v | |
let (>>=) m f = | |
match m with |
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
# Git branch in prompt. | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ " |
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
using System; | |
namespace FSM.BankAccount | |
{ | |
public abstract class BankAccountState | |
{ | |
public static readonly BankAccountState ZeroBalanceState = new ChoiceTypes.ZeroBalanceState(); | |
public static readonly BankAccountState ActiveState = new ChoiceTypes.ActiveState(); | |
public static readonly BankAccountState OverdrawnState = new ChoiceTypes.OverdrawnState(); | |
public static readonly BankAccountState ClosedState = new ChoiceTypes.ClosedState(); |
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
namespace Utility.Monads | |
[<AutoOpen>] | |
module MaybeMonad = | |
type MaybeBuilder() = | |
member this.Zero() = this.Return () | |
member this.Bind(m, f) = Option.bind f m | |
member this.Return(x) = Some x | |
member this.ReturnFrom(x) = x | |
member this.Yield(x) = Some x |
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
# generated by Git for Windows | |
test -f ~/.profile && . ~/.profile | |
test -f ~/.bashrc && . ~/.bashrc | |
#from http://stackoverflow.com/questions/33220492/ps1-bash-command-substitution-not-working-on-windows-10 | |
# Reset | |
Off="\[\e[0m\]" # Text Reset | |
# Regular Colors |
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
module Tree = | |
type NodeId = | Id of string | |
with | |
member this.unapply = match this with | Id x -> x | |
[<AutoOpen>] | |
module internal Node = | |
[<AbstractClass>] | |
type NodeBase<'a> () = class | |
member val internal Children : NodeBase<'a> list = [] with get, set |
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
// F<'a> is any type with member 'map' of type ('a -> 'b) -> F<'a> -> F<'b> | |
type F<'a> = QIL<'a> | |
and S<'a> = F<Q<'a>> | |
and Q<'a> = | |
private | |
| Step of Step<'a> | |
| Bind of IBind<'a> | |
with | |
static member lift (k : F<'a>) : Q<'a> = Step (Suspend (fun () -> S<_>.map (Yield >> Step) k)) |
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
using Microsoft.Extensions.Logging; | |
using Orleans; | |
using Orleans.Configuration; | |
using Orleans.Hosting; | |
using System; | |
using System.Threading.Tasks; | |
namespace Orleans2GettingStarted | |
{ | |
internal static class ClientDevelopmentHelpers |