Skip to content

Instantly share code, notes, and snippets.

@swlaschin
swlaschin / Calculator_implementation.fsx
Last active July 30, 2023 14:50
Type-first design and implementation for a calculator app
(*
Calculator_implementation.fsx
Related blog post: http://fsharpforfunandprofit.com/posts/calculator-implementation/
*)
// ================================================
// Draft of Domain from previous file
// ================================================
module CalculatorDomain_V3 =
@swlaschin
swlaschin / enterprise-tic-tac-toe-2.fsx
Last active June 5, 2023 22:16
Follow up to the example of implementing "enterprise" tic-tac-toe in a functional way.
(*
enterprise-tic-tac-toe-2.fsx
Follow up to the example of implementing "enterprise" tic-tac-toe in a functional way.
* Added true capability based security.
Related blog post: http://fsharpforfunandprofit.com/posts/enterprise-tic-tac-toe-2/
*)
@swlaschin
swlaschin / enterprise-tic-tac-toe.fsx
Last active June 5, 2023 22:10
An example of implementing "enterprise" tic-tac-toe in a functional way. Related blog post: http://fsharpforfunandprofit.com/posts/enterprise-tic-tac-toe/
(*
enterprise-tic-tac-toe.fsx
An example of implementing "enterprise" tic-tac-toe in a functional way.
Related blog post: http://fsharpforfunandprofit.com/posts/enterprise-tic-tac-toe/
*)
open System
@swlaschin
swlaschin / linq2fs.md
Last active March 7, 2023 22:15
C# LINQ -> F# equivalent
@swlaschin
swlaschin / SixDependencyApproachesInPractice.fsx
Last active February 25, 2023 06:05
Code examples from fsharpforfunandprofit.com/posts/dependencies-5/
(* ===================================
Code from my series of posts "Six approaches to dependency injection"
=================================== *)
open System
(*
## The requirements
@swlaschin
swlaschin / dmmf_workshop.md
Last active January 16, 2023 22:09
Setup instructions for my 16 hr (2 full day or 4 half day) Domain Modeling Made Functional workshop

Setup instructions for the 16 hr (2 full day or 4 half day) Domain Modeling Made Functional workshop

Requirements:

  • Git (optional)
  • F#

I will assume that you have git already installed.

Install F#

(*
CapabilityBasedSecurity_ConfigExample.fsx
An example of a simple capability-based design.
Related blog post: http://fsharpforfunandprofit.com/posts/capability-based-security/
*)
/// Configuration system
module Config =
@swlaschin
swlaschin / monadster.fsx
Last active October 19, 2022 22:05
F# scripts demonstrating a custom state monad. Related blog post: http://fsharpforfunandprofit.com/posts/monadster/
(*
monadster.fsx
Demonstrates how the state monad works
See also monadster2.fsx for the refactored version using computation expressions.
Related blog post: http://fsharpforfunandprofit.com/posts/monadster/
*)
(*
JsonParser.fsx
A JSON parser built from scratch using a combinator library.
Related blog post: http://fsharpforfunandprofit.com/posts/understanding-parser-combinators-4/
*)
#load "ParserLibrary.fsx"
@swlaschin
swlaschin / DependencyInjection.fsx
Last active April 13, 2022 17:37
Code examples from fsharpforfunandprofit.com/posts/dependencies-3/
(* ===================================
Code from my series of posts "Six approaches to dependency injection"
=================================== *)
open System
(* ======================================================================
4. Dependency Injection