4

I'm thinking of moving into functional programming. I'm deciding between F# and Haskell. I don't like that both have indentation as syntax, but that's neither here nor there.

I know the .net core stdlib like the back of my hand. I'm trying to decide - and, as the purpose of this post, trying to ask the community - if this is a *bad* thing when trying to learn a new programming paradigm.

In other words, I think I want to try Haskell because I won't be able to lean on my knowledge of the standard library. I'll be forced to actually understand the language and learn functional concepts, instead of trying to bring my OOP knowledge over from C#.

Additionally, the .net stdlib is obviously built in a OOP design, so I'm afraid that the F# stdlib might suffer from that too.

But I'm still thinking that maybe my knowledge of the .net stdlib will be more helpful than harmful? Like, yes, I'll be using it as a crutch but at least I won't be trying to learn three things at a time (stdlib, syntax, and paradigm) and can focus solely on the syntax and paradigm.

Anyone have any insight into this problem, or maybe some wild guesses?

Comments
  • 2
    Sounds great! I often wanted to learn Haskell or F#, too, but never actually did it.
    So I have no advice here.
    As you said, it seems that both approaches have pros and cons.

    Coincidentally yesterday I learned that the backend of my current project is written in Haskel. 😄
  • 2
    As a wise man once said: "I'm not clever enough to do functional programming and neither are you."
  • 1
    @Lensflare wow, a web api in haskel?
  • 1
    @whimsical not just the web api, but also storage and the BL, everything, the whole backend!
    It freaking blew my mind!
  • 1
    @Lensflare why would anyone ever do that? What are you making?
  • 1
    @whimsical I have no idea why. As I said, I was as surprised as you are. As for what I‘m making, I don’t want to tell on devrant directly but you can look it up in my github if you like.
  • 1
    @Lensflare haha, scaledtofit is something I made a few days ago too.
  • 1
    @whimsical nice! 😄
  • 1
    > both have indentation as syntax

    sacrilege
  • 1
    @Liebranca seems like it’s a trope in the functional space :(
  • 1
    @AlgoRythm the academic circle jerk does indeed breed higher forms of degeneracy.

    but more on topic i vaguely recall trying both ocaml and haskell at one point out of curiosity forever ago, wanted to see what the fuzz was about. my lasting impression is that functional languages were specifically designed for mathematicians to cosplay as programmers, i really do get that vibe.

    as i see it, strict FP makes nearly everything more complicated than it needs to be for no benefit, save a vague sense of correctness that i find to be more illusory than anything else. akin to writing an abstract class for the first time, not quite right but feels like it if you think hard enough. i can't stand the hyperfocus on theory rather than practice is what i'm getting at.

    anyway, learn haskell, 0/10 it's the last thing i would recommend to a sentient being. but if you want to learn functional it'll do the trick.
  • 0
    @Liebranca I spent today studying F# and I can confirm the stdlib is the main drawback: it's designed to be compatible with the .net framework 100%, so the function calls are not curried by default, they're tupled. So insted of calling them in a functional way, you call them in a traditional c# etc way;

    F#:

    print "hello %s" world

    F# Standard library:

    print("Hello %s", world)

    Which was a major disappointment, so I'll be shelving this functional thing and moving to Haskell when I get the itch again. Shame.
  • 0
    @Liebranca In reference to what you actually said, I agree. From my reading, the real benefits of functional languages is they're optimized for recursion (or, more to the point, they're more optimized to turn recursion into something actually performant!)

    From the code I've been writing, it's a lot more difficult, but the code ends up being shorter and a lot closer to what you're actually trying to do.

    Like, I saw a quicksort (unoptimized) that was essentially just the algorithm in plain f#. There was barely any implementation, it was just "here's how the algorithm works, here's how to say that in f#, done"

    https://fsharpforfunandprofit.com/p...
Add Comment