Skip to content

Instantly share code, notes, and snippets.

@musheddev
musheddev / diff.fsx
Created May 18, 2026 00:58
Patch Theory
open System.Collections.Generic
type Default6 = class end
type Default5 = class inherit Default6 end
type Default4 = class inherit Default5 end
type Default3 = class inherit Default4 end
type Default2 = class inherit Default3 end
type Default1 = class inherit Default2 end
@musheddev
musheddev / DailyTimer.fs
Created March 14, 2023 15:55
Schedule at Precise time
open NodaTime
open NodaTime.Text
open System.Threading
let chicago = DateTimeZoneProviders.Tzdb.["America/Chicago"]
type TimerDaily (fn: (unit -> unit), hour : int, minute : int, ?zone : DateTimeZone) =
let timeZone = zone |> Option.defaultValue chicago
let clock = ZonedClock(SystemClock.Instance,timeZone,CalendarSystem.Iso)
let mutable _timer = Unchecked.defaultof<System.Threading.Timer>
let next () =
@musheddev
musheddev / CloudWatchMetrics.fs
Created March 14, 2023 15:49
Cloud Watch Metrics
module CloudWatchMetrics
open System
open System.Collections.Concurrent
open System.Threading
open Amazon.CloudWatch
open Amazon.CloudWatch.Model
open FSharp.Control.Tasks.Affine
open Serilog
@musheddev
musheddev / ThreadedActor.fs
Created March 14, 2023 15:16
ThreadedActor
module ThreadedActor
open System
open System.Collections.Concurrent
open System.Threading
module ActorStatus =
[<Literal>]
namespace ActiveParsers.ANTLR
open System
open FSharp.Compiler.SyntaxTree
open FsAst
open Myriad.Core
[<RequireQualifiedAccess>]
module Generator =
type ANTLRAttribute(filePath : string) =
@musheddev
musheddev / FCA.md
Last active December 27, 2019 01:05
Functonal Core Architecture

Functional Architecture is not the same as functional programming, it is not focused on functional languages and program purity, catagories, monads, lambda calculus. It is more about data flow, dependecy rejection, side effect mangament, etc. The end result of applying functional principles to the architecture level of design begins to favor CQRS + Event Sourcing and hexongonal architecures. https://www.youtube.com/watch?v=US8QG9I1XW0 (Introductory talk by Mark Seaman)

I have had several long discussions with jermie at the openfsharp conference, here is his introduction. https://thinkbeforecoding.com/post/2018/01/25/functional-core

Dependency Rejection

One key element is what Mark Seaman calls dependency rejection. The essential trait here is that there is no dependecies / interfaces / db calls / effects in the business logic.