Interface in F#

module interfaceexample

type IMyFSharpInterface=
abstract member memberWithOneInput : int ->unit
abstract member memberWithTwoInput : int -> float->unit


type MyFSharpInterfaceImpl()=
interface IMyFSharpInterface with
member this.memberWithOneInput x = printfn “I am memberWithOneInput implementation”
member this.memberWithTwoInput x y = printfn “I am memberWithTwoInput implementation”

let classobject =new MyFSharpInterfaceImpl()
let a = (classobject:>IMyFSharpInterface).memberWithOneInput 1
let ab = (classobject:>IMyFSharpInterface).memberWithTwoInput 1 2.5


First hand experience with F#

I have been studying F# lately and more I read more i fall for functional programming languages.

I have also developing a REST service over last few weeks using Service Stack framework for restfull services in  C#.

To play around with F# i have decided to migrate my same service from C# to F# with ServiceStack  itself .

Below 3  new things for me to explore  at same time

  • — Differences between F#2.0 and F# 3.0
  • — first hand functional programming experience
  • — F# with Service Stack ( console hosting)

Below are are the outcomes of my migration:

  • Clear code
  • Less code about 60% less code
  • No hit and trial , code worked in first compilation
  • Faster development time (over 50% gain)

I will explore more and hopefully i choose this as main programming language for my upcoming Large size project.

Resources for F#