F# Create a module
https://dotnetfiddle.net/
module LeandroMathFuncs =
type Pair = {X : int; Y : int}
let createPair x y =
{ X = x; Y = y}
/// This adds two integers together!!!
let addPair pair =
pair.X + pair.Y
let add x y =
x + y
let incrementByOne x =
x + 1
let incrementByOneImp =
// Code reuse of add function using partial application
add 1
module L = LeandroMathFuncs
let myPair = L.createPair 1 2
printfn "Result 1 + 2 = %i" (L.createPair 1 2 '> L.addPair)
printfn "Result incremented by 1 = %i" (LeandroMathFuncs.incrementByOne 2)
printfn "Result incremented by 1 using add function = %i" (LeandroMathFuncs.incrementByOneImp 2)
open LeandroMathFuncs
printfn "Same result %b" ((incrementByOne 5) = (incrementByOneImp 5))