4 ms·
Only to an untrained eye. F# is a firmly rooted in ML language family history, only making concessions where necessary due to the fact it's running on the CLR.
by HappyDoge 6y ago
Only to an untrained eye. F# is a firmly rooted in ML language family history, only making concessions where necessary due to the fact it's running on the CLR. Scala is a random walk of language design space, with different ideas either working or ending up complete trainwrecks, and the fact it's missing this clean ML core makes it a painful language to pick up coming in from F# (or in fact most other statically typed FP languages).
- deleted 6y ago[deleted]
- smabie 6y agoI mean, considering that Scala has a much more powerful type system than F# and you can actually implement FP concepts like monads, functors, etc makes it arguably more FP than F#. While I haven't used F# much, as a professional OCaml and Scala dev, Scala is hands down the more powerful language. OCaml isn't bad, but it leaves a lot to be desired. A little offtopic, but if OCaml got rid of its module system, added type classes, polymorphic functions, higher-kinded types, multi-core support and removed objects (not that it matters that much), it would be my dream language. Basically, I want Haskell without the dogma. Though, I guess that's what unsafePerformIO provides!
- siwatanejo 6y agoWhy do you say you cannot implement monads and functors in F#? sorry but this is bullshit
- smabie 6y agoF# doesn't support higher-kinded types.
- siwatanejo 6y agoThat doesn't make functors and monads impossible to implement.
- smabie 6y agoOf course not, but it means that there is no type that abstracts upon all of them. For example, in Haskell, you can >>= and >> just about everything and it'll work. In OCaml (and I assume F#), you have to import the right kind of >>= and >>. This is quite burdensome and creates a lot of repetitive and nasty code. The lack of polymorphism in ML languages is such a bummer.
- HappyDoge 6y agoOstensibly yes, but F# has limited and clunky compile time ad-hoc polymorphism mechanism that can be used to implement "type classes" - which however can be abused to great effect if you really want generalised binds https://github.com/fsprojects/FSharpPlus https://github.com/fsprojects/FSharpPlus. Not to mention it has subtype polymorphism on par with what you get in C# that you can really get a lot of mileage from (and which gets too easily glossed over by some FP neophytes), AND an extensive reflection API to bridge the gap if you have nothing else to fall back to.
- HappyDoge 6y agoSure, Scala has fancier stuff on the high end of things, but it doesn't nail the basics the way F# does. I don't feel like sacrificing day-to-day productivity so I can skip duplicating some code with recursion schemes. Your dream language sounds a lot more like F# than Scala tbh. F# doesn't have (easy to use) type classes or higher kinded types, but has simplified modules and full access to .NET object system for all your polymorphism needs, and a much more seamless interop with the platform it's running on as there's significantly less "magic" happening in the compiler compared to Scala.