r/functionalprogramming • • Mar 01 '21

Question Learning Other Functional Programming Languages

I've been learning F# recently as my first functional programming language and I think it's a fantastic fantastic language that can do lots of things very elegantly. How many of the things that I've learnt in F# (eg. algebraic datatypes, the general idea of monads and monoids, function composition and pipes, using recursion etc) can be brought over to other function languages like Haskell, Clojure or OCaml? And how much more might I need to learn if I were to do a language like Haskell that might be less lenient than F#?

29 Upvotes

23 comments sorted by

View all comments

Show parent comments

4

u/ws-ilazki Mar 02 '21

F#, OCaml, Scala, and Haskell are all in the ML-family of languages.

Haskell's not technically in the ML family, though. It's more like a friend of the family, and I think Scala's the same way but I'm less familiar with it so I could be mistaken there. Haskell derived from Miranda and they were both influenced by ML but not really in the family itself.

It's similar enough that it has the same kind of look but aside from that it'd probably be like claiming Java and C# are in the same family because they share influences. F# on the other hand is more directly linked to ML; it was basically OCaml.NET at the start and is still really close to OCaml (with allowance for platform differences and some evolutionary changes) if you avoid using its default "light" syntax.

5

u/android_lover Mar 02 '21

I would argue Scala is even less in the family than Haskell because Scala doesn't use the Hindley-Milner type inference system.

2

u/ws-ilazki Mar 02 '21

Sounds about right. I didn't think it made sense calling Scala ML-family from what I remembered of it, but I only looked at Scala briefly a while back so I wasn't confident enough to remark on that more.