2 people like it.
Like the snippet!
Minimal coding kata setup
Minimal coding kata setup that I use in my trainings - the aim is to use as simple F# syntax as possible and to have a nice way for specifying placeholders that attendees are required to fill.
// Minimal setup for coding katas (I usually put this in "setup.fsx")
let __<'T> : 'T = failwith "Placeholder '__' was not filled!"
let shouldEqual a b =
if not (a = b) then
failwithf "Values are not equal!\n Expected: %A\n Received: %A" a b
// Sample tasks with placeholders and equality tests (#loads "setup.fsx")
let nums = 40 + __
shouldEqual nums 42
val failwith : message:string -> 'T
Full name: Microsoft.FSharp.Core.Operators.failwith
val shouldEqual : a:'a -> b:'a -> unit (requires equality)
Full name: Script.shouldEqual
val a : 'a (requires equality)
val b : 'a (requires equality)
val not : value:bool -> bool
Full name: Microsoft.FSharp.Core.Operators.not
val failwithf : format:Printf.StringFormat<'T,'Result> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.failwithf
val nums : int
Full name: Script.nums
val __<'T> : 'T
Full name: Script.__