DEV Community

loading...

Discussion on: F# is Pretty Cool

Collapse
deciduously profile image
Ben Lovy Author • Edited

Thanks so much for the advice!

I was using Ionide but had a rough go from the start and immediately fell back to the dotnet command. I'll give it another go, but I've also been meaning to start learning a bit about VS, too - might be a solid excuse. That plugin will definitely help it feel a little more comfortable. I've had an Elm project in the back of my head for a while - no reason it couldn't be Elmish!

Collapse
kspeakman profile image
Kasey Speakman • Edited

MVU style is amazing. Go for it either way! Elm is better for learning to write pure functions TBH. Fable-Elmish is structurally and syntactically very similar while being far less restrictive. For the latter, I do recommend keeping side effects out of init/update if you want to keep the refactor/test benefits from having pure functions. (Cuz F# does not stop you from putting side effects in those functions.)

Thread Thread
deciduously profile image
Ben Lovy Author

Interesting - I do love compiler-enforced discipline, but it's always nice to have an escape hatch - and F# seems like a more broadly applicable language if I'm going to invest some time in one or the other. I'll have to think about it.

Thread Thread
kspeakman profile image
Kasey Speakman • Edited

Yeah, I vote for F#. But wanted to give a props to Elm for teaching me the value of pure functions. I came from C# to F# and still fell back to a lot of mutation-based/imperative solutions for a while. Elm forced me do pure functions (along with MVU, which structures most of the code to be written in pure functions) and experience their benefits. But if you understand that pure (aka referentially transparent, aka deterministic) functions produce output based only on their inputs. And if you understand the value of using them. Then it is pretty easy to understand whether you have written a pure function or not in F#, even without a compiler warning. Plus F# is great for back-end work too. (Kestrel on .NET Core is known to be a pretty fast web server.)

Thread Thread
deciduously profile image
Ben Lovy Author • Edited

Awesome. I think Haskell drilled the concept in pretty well but I still always sort of miss the rigidity whenever it's gone. I'm heavily leaning F# now too - I'll have to look in to Kestrel!

Thread Thread
kspeakman profile image
Kasey Speakman • Edited

Kestrel is the built-in .NET Core web server. It isn't functional or anything, but it is very fast -- look for aspcore. Giraffe is a F#/functional lib on top of Kestrel. I also wrote my own for API routing only.

Thread Thread
deciduously profile image
Ben Lovy Author

Cool! Definitely looking forward to digging deeper in to this, thank you.