Hacker News new | past | comments | ask | show | jobs | submit login

I had the exact same problem. Even all the http servers had a lot of .net boilerplate to get started. A lot of that should be abstracted. I built an http server library that abstracts the .net parts. https://wiz.run/

The hello world server:

  open Wiz.Server
  open Wiz.Context
  open Wiz.Route

  let myHandler ctx =
    ctx |> sendText "Abra Kadabra Kalamazoo!"

  let myRoutes = [
    get "/" myHandler
  ]

  genServer()
  |> setRoutes myRoutes
  |> run



thinking more about it, F# needs to appeal to non-dotnet developers and other developers looking for a functional language for real workloads.

F# currently seems easiest for c# dev to get started, but c# devs have almost no incentive to do so.


I could say the same thing about any language. For instance:

"Python needs to appeal to C# developers and other developers...

Python seems easiest for PHP devs to get started, but C# devs..."

And, the truth is, no, Python doesn't need to do that at all. It just has to be the best Python it can be.


I was thinking as a conscious strategy that would impact the way all libraries are built. In my example I posted above, there are no dotnet APIs showing. Its all abstracted. Libraries should create new APIs that are just wrappers around the dotnet library.

Whereas, if you look at the examples in the Giraffe framework, you need to do a bunch of dotnet boilerplate. https://github.com/giraffe-fsharp/Giraffe#doing-it-manually

  open System
  open Microsoft.AspNetCore.Builder
  open Microsoft.AspNetCore.Hosting
  open Microsoft.Extensions.Hosting
  open Microsoft.Extensions.Logging
  open Microsoft.Extensions.DependencyInjection
  open Giraffe

  let webApp =
      choose [
          route "/ping"   >=> text "pong"
          route "/"       >=> htmlFile "/pages/index.html" ]

  type Startup() =
      member __.ConfigureServices (services : IServiceCollection) =
          // Register default Giraffe dependencies
          services.AddGiraffe() |> ignore

      member __.Configure (app : IApplicationBuilder)
                          (env : IHostEnvironment)
                          (loggerFactory : ILoggerFactory) =
          // Add Giraffe to the ASP.NET Core pipeline
          app.UseGiraffe webApp

  [<EntryPoint>]
  let main _ =
      Host.CreateDefaultBuilder()
          .ConfigureWebHostDefaults(
              fun webHostBuilder ->
                  webHostBuilder
                      .UseStartup<Startup>()
                      |> ignore)
          .Build()
          .Run()
      0


You have to learn some of .NET framework if you plan to use its features like ASP .NET, but you do not have to learn C#.

If you plan to use Python you have to learn some Python libraries.


I get that you have to now. my point is that you shouldn't have to. lot of it could be abstracted. the more that is abstracted then the lower the barrier for newcomers.


Using Python doesn't require you to learn a (big) second language before you can do anything useful, though. F# arguably does. Maybe that is the best F# that F# can be. Which, for a lot of people, is not good enough.


I am a C# developer and I find F# very interesting. I love the functional paradigms in C# and I want to be able to use more of a functional style.

I like how well written F# code is less verbose while being very readable.

I want to learn another language. I was thinking about Go, Rust and Kotlin. I excluded Kotlin because it seems it doesn't bring me much value over C# and I excluded Go for the same reason.

I dabbled a bit in Rust, but so far I don't like it's verbosity, the fact that it is boiler plate-ish.

So I reminded myself of F# and started learning that. I know that it has a huge disadvantage compared to the others, it is far less popular, but on the other hand, I can use F# in the same projects I use C# and some of the thing I learn while learning F# might be applicable to C#.

I feel that F# is a niche language mainly because of of two things: Microsoft doesn't care much about it to push it and help it to thrive. And they don't push it because it has a small community. I seems that Microsoft is investing more resources in Python or Java than in F#. The other thing is that the largest community sees it as a Microsoft language and that is enough of a reason not to touch it.

Whatever growing adoption F# has its due to efforts of it's tiny but very enthusiastic community which is helping it to jump some barriers like frontend programming.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: