←back to thread

Why F#?

(batsov.com)
447 points bozhidar | 1 comments | | HN request time: 0.212s | source
Show context
GiorgioG ◴[] No.43546539[source]
As a 20+ year C# developer I’ve tried several times to learn/use F#. Despite being interested in FP, my brain is having trouble figuring out how to structure my code in F#. In C# I’d either build a service (or use the mediator pattern) for the domain and a repository for data access. With F# it’s functions all the way down and it feels unnatural (as silly as that may sound).
replies(4): >>43546782 #>>43546899 #>>43551623 #>>43556011 #
jcmontx ◴[] No.43546782[source]
The secret is currying. Replace your DI for currying and you'll start to see somewhat similar patterns
replies(1): >>43550330 #
1. Smaug123 ◴[] No.43550330[source]
By the way, I consider https://www.bartoszsypytkowski.com/dealing-with-complex-depe... to be the canonically correct way to do DI when you want to inject more than like two dependencies.