Skip to content

Instantly share code, notes, and snippets.

View jovaneyck's full-sized avatar

Jo Van Eyck jovaneyck

View GitHub Profile
jovaneyck /
Last active September 5, 2023 07:10
Code kata workshop - links
jovaneyck / swaggerprovider-demo.fsx
Created May 6, 2023 14:47
An example on how to use SwaggerProvider: a type provider that automatically generates strongly-typed clients for openapi REST api's
View swaggerprovider-demo.fsx
#r "nuget: SwaggerProvider, Version=2.0.0-beta9"
open SwaggerProvider
open System
open System.Net.Http
type PetStore = OpenApiClientProvider<"">
jovaneyck / binarysearchtree-properties.fsx
Last active October 2, 2022 10:43
Example properties for a binary search tree implementation
View binarysearchtree-properties.fsx
//Inspired on "How to specify it!" by John Hughes (& Java adaptation by Johannes Link)
#r "nuget: fscheck"
open FsCheck
module BST =
type BinarySearchTree<'v> =
| Empty
| Node of
jovaneyck /
Created November 15, 2018 21:31
Peano arithmetic as an introduction to prolog
%load a prolog file like [this].
%or just send file to REPL
%Peano arithmetic
% * 0 is a natural number
% * if n is a natural number, s(n) is a natural number
% * equality
% * 0 = 0
% * a = b -> s(a) = s(b)
jovaneyck / fscheck3.fsx
Last active September 15, 2021 11:55
FsCheck v3 breaking API, how to use in F#
View fscheck3.fsx
#r "nuget: FsCheck, version=3.0.0-beta1"
open FsCheck
open FsCheck.FSharp
let revRev xs = xs |> List.rev |> List.rev = xs
Check.QuickThrowOnFailure revRev
type Tree<'a> = Branch of Tree<'a> * Tree<'a> | Leaf of 'a
View csharp-language-ext-pipelines.cs
using System.Threading.Tasks;
using LanguageExt;
using Xunit;
namespace LanguageExtDemo
public class Repository
public OptionAsync<string> GetName(int id)
View Either.cs
using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Xunit;
using LanguageExt;
using static LanguageExt.Prelude;
namespace LanguageExtDemo
View sharpvg-demo.fsx
#r @"C:\Code\SharpVG\SharpVG\bin\Debug\netstandard2.1\SharpVG.dll"
#r @"C:\NugetLocal\netstandard\build\net461\lib\netstandard.dll"
open SharpVG
let black = Color.ofName Black
let opaque = 1.0
let style = Style.create black black opaque opaque
let lineAt p1 p2 = Line.create (Point.ofInts p1) (Point.ofInts p2) |> Element.create |> Element.withStyle style
jovaneyck / pbt.fsx
Created November 17, 2018 15:50
Property-based testing in F#
View pbt.fsx
#r @"C:\NugetLocal\FsCheck.2.4.0\lib\net45\FsCheck.dll"
open FsCheck
//Simple property
let reversingAReversedList l = List.rev (List.rev l) = l
Check.Quick reversingAReversedList
//Failing property: example of standard shrinking
let reversingAList l = (List.rev l) = l
Check.Quick reversingAList
jovaneyck / gist:444fd6c39933ce9b5984f06d9193179a
Last active May 25, 2018 13:01
GivenWhenThen hierarchy abuse example. Try to investigate failure of WhenTargetContractDoesNotCorrespondToSourceContractOtherFirmnessLevel.ThenRuleShouldFail()
View gist:444fd6c39933ce9b5984f06d9193179a
public class WhenTargetContractDoesNotCorrespondToSourceContractOtherFirmnessLevel : GivenRulesDeterminedFromDatabaseConfiguredRules
private ICapacityConversionRequest capacityConversionRequest;
private IRepository<ITransmissionService> transmissionServiceRepository;
private void GivenParameters()
this.capacityConversionRequest = MockRepository.GenerateStub<ICapacityConversionRequest>();