Skip to content

Instantly share code, notes, and snippets.

// Odin Error Challenge in F#
// see: https://rm4n0s.github.io/posts/3-error-handling-challenge/#odins-teachings-in-action
// try pasting the code into: https://sharplab.io/
type F1_Error =
| None
| Account_Is_Empty
| Investment_Lost
type F2_Error =
@iskeld
iskeld / NaryTreeStateMonad
Created May 29, 2014 20:04
F# State Monad implementation for n-ary tree (based on "The Zen of Stateless State" video by Brian Beckman)
open System
type Tree<'a> =
| Leaf of 'a
| Branch of Tree<'a> list
type StateMonad<'state, 'content> = StateMonad of ('state -> ('state * 'content))
let testTree =
Branch [