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#





Add extension to your Service stack response


I had a case in my project to change the default extn of the response file (csv )to something else.

Thank God I was using Service Stack so I on the fly saved;)


Just add a Response filter and do what you wish todo .Add below code to your apphost.cs file


this.ResponseFilters.Add((req, res, dto) =>
                if (req.ResponseContentType == ContentType.Csv)
                    string.Format("attachment;filename={0}.bin", req.OperationName+ Guid.NewGuid().ToString()));