https://kotlinlang.org logo
#functional
Title
# functional
h

horse_badorties

07/08/2020, 9:25 AM
Hi there, basically my question is this: should I pick Kotlin to learn "real" functional programming?  Some background: I am - yet another - old school OO/Java developer wanting to learn functional programming. Since Java8/Lambdas/Streams I actively use "functional" concepts whenever I feel it makes sense, but more on a method-level scale. I still have no idea how to build an entire real world app that way. My desire to really learn FP is to evolve as a programmer, to expose myself to new concepts. This is not a career decision or something. My plan is to start with some playing around, some katas, some coding games. And finally a "real world" web app. I have no mathematical background and I'm not interested in the academic aspects of FP. I would like to understand FP as a tool for "real world programming". So the obvious language choice would have to be something like Haskell, to force me into "proper" functional programming.  Since I know and enjoy VS Code I was happy to see Haskell plugin support there, so I tried to get into it. But I was really struggling with the (IMHO poor) tooling. I am prepared to struggle with the new concepts, the new language, the new thinking. But fighting with the tooling for days on end really puts me off.  I am now considering F#, which is "functional first" with professional tooling (VS Code) and I will probably end up picking this. But not before considering Kotlin again. 😄 I had already used Kotlin in private side projects two or three years ago and absolutely loved it, because it really is "the better Java". Unfortunately I can not use it in my day job, because there is no way around Eclipse in our projects for various reasons. This will not change. So here is my question again: Should I pick Kotlin to learn "real" functional programming?  I'm aware that you guys are probably a bit biased - I'm prepared for that.  And sorry for the wall of text.
s

simon.vergauwen

07/08/2020, 10:49 AM
Hey, We're working hard in Arrow to make FP much more idiomatic in Kotlin. To that end we recently reworked
IO
to work completely in
suspend
syntax. (https://github.com/arrow-kt/arrow-fx/pull/169) And in the description there you can also see how we're trying to simplify working with other functional constructs, especially when you want/need to combine different types/concerns.
I'm also a trainer at 47 Degrees Academy, besides training and courses. We also regularly give free online talks & webinars, both from Academy and in collaboration with different meetups, etc. The next one is next week Tuesday on Arrow Optics (https://arrow-kt.io/docs/0.10/optics/dsl/). You can find much more information on the Arrow website. (https://arrow-kt.io) And all Arrow specific questions are also welcome in #arrow 🙂
We're also always happy to give mentorship to anyone that is interested in becoming an Arrow OSS contributor 🙂
Side-note: Eclipse has Kotlin support, no?
However if it's just to learn FP, then Haskell might be the way to go. Unless you're planning to do some with your learned Kotlin skills in the near future. The principles will be the same everyone, but only Haskell or Purescript will actually force you to abide by the FP rules. Additionally, what Haskell offers is not perse what we with Arrow want to achieve in Kotlin. We want to have the same guarantees, principles & laws, but we don't want to inherit unnecessary complexity that's not needed in Kotlin. (I.e.
suspend
instead of
IO
).
s

stojan

07/08/2020, 12:40 PM
My path to learning FP was mostly reading Scala and F# resources (books and talks) and trying to apply the concepts in Kotlin Kotlin has less resources than Scala/F# which is why I used resources from those communities. And I do Android (which is Java or Kotlin) so I was applying the concepts in Kotlin The nice thing about FP is that the concepts are language agnostic and transferable between languages You can use Kotlin to do real world FP, but I don't have an answer if you should do it, it's up to you
h

horse_badorties

07/08/2020, 2:30 PM
thanks for your comments!  I will certainly look at Arrow should I end up picking Kotlin. 👍 @simon.vergauwen Unfortunately the Kotlin plugin for Eclipse is not ready for primetime, not even close. As it stands Intellij/Android Studio is the only viable option for Kotlin development, at least AFAIK.
🙌 1
@stojan care to share those resources that you found helpful? 😃
also the Red book in Scala, the Functional Programming in Scala course by Odersky on Coursera A bunch of videos from here: https://fsharpforfunandprofit.com/video/
and a lot more...
h

horse_badorties

07/09/2020, 9:40 AM
thanks!
👍 1
p

PhBastiani

07/09/2020, 12:50 PM
Also : The joy of Kotlin by @pysaumont... An intro to FP ! This book helps us understand what a data type is, why lazy evaluation is so important, how to use traverse... This Kotlin book is old (published before the first release of Kotlin Coroutines). The repository contaning addons, code, exercises and solutions from the book: https://github.com/pysaumont/fpinkotlin
👏 2
d

dharrigan

07/13/2020, 7:48 PM
Would you consider Clojure?
h

horse_badorties

07/14/2020, 7:21 AM
no, I don't. But only because the Lisp-like syntax somehow never appealed to me at all.
👍🏽 1
4 Views