Can the program below be optimised.
-For speed. (eg inline , how)
-Less boilerplate (eg wrapping functions).
Or is it ok as it is?
open System
open Xunit
type IAnimal =
abstract member Name: string
abstract member Talk: string -> unit
type Chicken(name: string) =
//i:instance
member _.iName = name
member _.iTalk(msg: string) =
printfn $"My name is: {name}"
printfn $"Cluck: {msg}"
interface IAnimal with
member this.Name = this.iName
member this.Talk(msg: string) = this.iTalk (msg)
let animalFunction (a: IAnimal) : unit =
printfn ("I am the animalFunction")
printfn $"In the AnimalFunction i am called: {a.Name}"
a.Talk("Koekoek from animalFunction")
[<EntryPoint>]
let main (args: string array) : int =
printfn "Hello World \n"
let c = Chicken("Clucky")
c.iTalk ("Koekoek")
c |> animalFunction
0