Skip to content

Instantly share code, notes, and snippets.

View pblasucci's full-sized avatar

Paulmichael Blasucci pblasucci

View GitHub Profile
@pblasucci
pblasucci / Environment.fs
Last active June 12, 2023 19:21
One possible way to handle dependency management with F# and AvaloniaUI
(*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
@pblasucci
pblasucci / MyStack.fs
Last active October 7, 2022 13:05
A contrived example of the "abstract data type" pattern in F#.
(*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@pblasucci
pblasucci / Gisty.Maths.fsproj
Last active October 7, 2022 13:04
Using signature files and script files to test private functionality
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Library.fsi" />
<Compile Include="Library.fs" />
@pblasucci
pblasucci / AoC_Day6_Common.fs
Last active December 9, 2021 07:52
Some quick-and-dirty playing around with Advent of Code 2021, Day 6 (https://adventofcode.com/2021/day/6)... and, no, this soluion won't actually scale up to larger inputs.
type [<Measure>] daysUntilSpawn
type Fish = uint8<daysUntilSpawn>
let inline fish value : Fish =
LanguagePrimitives.ByteWithMeasure<daysUntilSpawn> value
let [<Literal>] ReadyToSpawn : Fish = 0uy<daysUntilSpawn>
let [<Literal>] ResetFish : Fish = 6uy<daysUntilSpawn>
@pblasucci
pblasucci / Optional.cs
Last active April 28, 2021 19:00
(Yet another) Riff on Option/Maybe/etc. for C# 9
/*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
@pblasucci
pblasucci / Consumer.cs
Last active April 23, 2021 11:44
Exposing Discriminaed Unions from F# to C#
using System;
using FsLibrary;
namespace CsConsumer
{
public static class Program
{
public static void Main(string[] _)
{
var msg = Vsn.DefaultScheme.Either(