This file contains 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
// See https://aka.ms/new-console-template for more information | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
public static class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var build = CreateHostBuilder(args).Build(); |
This file contains 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; | |
// Trying to replicate https://github.com/ijrussell/FSharpForTheMasses/blob/main/IntroductionToFSharp/4-demo-ddd-3.fsx | |
namespace csharpchallenge | |
{ | |
record EligibleRegisteredCustomer(string Name, string Email) : Customer; | |
record RegisteredCustomer(string CustomerName, string? Email) : Customer; | |
record UnregisteredCustomer(string Name) : Customer; |
This file contains 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 abstract record StreamName; | |
public record AnEvent(string Description) : StreamName; | |
public static class DocumentStoreFactory | |
{ | |
public static DocumentStore Create() | |
{ | |
const string connectionString = | |
"PORT = 5432; HOST = 127.0.0.1; TIMEOUT = 15; POOLING = True; MINPOOLSIZE = 1; MAXPOOLSIZE = 100; COMMANDTIMEOUT = 20; DATABASE = 'postgres'; PASSWORD = 'Password12!'; USER ID = 'postgres'"; | |
var store = DocumentStore.For(options => | |
{ |
This file contains 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
open FParsec | |
let ws = spaces | |
let str_ws s = pstring s >>. ws | |
[<RequireQualifiedAccess>] | |
type QueryComparison = | |
| Equal | |
| NotEqual |
This file contains 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
open FParsec | |
[<RequireQualifiedAccess>] | |
type QueryComparison = | |
| Equal | |
| NotEqual | |
[<RequireQualifiedAccess>] | |
type TableOperators = | |
| And |
This file contains 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
open FParsec | |
[<RequireQualifiedAccess>] | |
type QueryComparison = | |
| Equal | |
| NotEqual | |
[<RequireQualifiedAccess>] | |
type TableOperators = | |
| And |
This file contains 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
open Domain | |
let awardPoint player state = | |
let result = Domain.awardPoint state player | |
printfn "Point to %A. Game is now %A" player result.Score | |
result | |
[<EntryPoint>] | |
let main argv = | |
let player1 = "Foo" |
This file contains 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 ConsoleApp1 | |
{ | |
public class Option<T> | |
{ | |
private bool hasValue; | |
private T value; |
This file contains 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 ConsoleApp1 | |
{ | |
public class Option<T> | |
{ | |
private bool hasValue; | |
private T value; |
This file contains 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 Person = | |
{ FirstName: string | |
MiddleInitial: string option | |
LastName: string } | |
module String50 = | |
let create (thing: string) = | |
if thing = null then Error "Its null" else Ok thing | |
module Result = |
NewerOlder