5 ms·
I love Haskell, but if you hate Java, but still want to leverage the nice Java ecosystem, (libs, IntelliJ, JVM, tooling, etc) try Kotlin! :) https://kotlinlang.
by KennyCason 10y ago
I love Haskell, but if you hate Java, but still want to leverage the nice Java ecosystem, (libs, IntelliJ, JVM, tooling, etc) try Kotlin! :)
https://kotlinlang.org/ https://kotlinlang.org/
- mahyarm 10y agoDoes kotlin have the same compile time, binary size and IDE indexer choking issues as Swift? I've heard that it has similar problems. I would not use Kotlin for a large project if that is the case.
- KennyCason 10y agoI used Kotlin for basically all of our machine learning/classifier code in a pretty large map/reduce + storm pipeline and have had no problems. IntelliJ also does not seem to have any problem with it either. (The IntelliJ authors being the the creator of Kotlin) In terms of code size, Kotlin is definitely smaller and easier to maintain. In terms of raw/clean compile speed, I would expect it to be a bit slower, but there are ways to improve it. One of the bigger ways is via incremental builds. I.e. Only build changed chunks of code, which Kotlin supports, and is comparable to, and in some cases faster than Java: https://medium.com/keepsafe-engineering/kotlin-vs-java-compilation-speed-e6c174b39b5d https://medium.com/keepsafe-engineering/kotlin-vs-java-compi... In terms of executable size, I don't have good data, but will investigate, but I'd say likely not a major deterrent given all the other value adds. :)
- mahyarm 10y agoSo how long would a generic heavy 100 kloc project take to compile? Full compile and changing one 200 line library file used by 1/4th of the project?
- KennyCason 10y agoI don't know. The experiments in the post only shows a limit set of examples. My hunch is that if you are using a modern compiler/IDE, you will not be coding -> compiling -> running that frequently. I typically code a lot before I actually actually run anything, so I'm not usually waiting around on a compiler. I don't even notice, at all, Java's incremental compilation when coding in IntelliJ. I refactor like a madman. Also, Kotlin is not very ambiguous, and the type inference that it does enable does not escape the scope of a function so the compiler doesn't have to do that much work. (functions require strict typing). I would guess much of that lambda work gives it a small headache, but probably not that much worse than Java's. If Kotlin grows mainstream, it's already pretty good compiler, will only get better. Of course, that is all a hunch. :)
- whateveracct 10y agoIf you love Haskell I guarantee you will not love Kotlin in the same way. Your best overall bet for Haskell-like FP on the JVM is Scala+cats/scalaz and other Typelevel-endorsed libraries. Unlike Kotlin, it gets pretty close.
- KennyCason 10y agoI mean, if you like Scala, you'll most likely like Kotlin, there are a LOT of similarities between the two.
- KennyCason 10y agoForgot to say, I agree with your statement. :) A pure Haskell fan, will likely not appreciate Kotlin the same way that a Java person appreciates Kotlin.
- virtualwhys 10y agoThat would be an odd choice for a Haskell alternative. Lacking higher kinded types and type classes is a bit of a show stopper. The obvious choice for Haskell on the JVM is Scala.
- iLemming 10y agoNope - the obvious choice for a functional language on JVM is not Scala and not Kotlin - it's Clojure.
- kpmah 10y agoHaskellers tend to be fond of their type system.
- KennyCason 10y agoIn a standard conversation, I would totally agree with you. However, since the OP is comparing Java vs Haskell, I figured I would offer something that's, imo, better than Java, and perhaps good enough that a pragmatic Haskeller can accept. Granted, Closure is probably a more pure alternative.
- pyrale 10y agoThe project is not super mature yet, but you could give Frege a try. Frege, as opposed to other solutions, is Haskell in a JVM. https://github.com/Frege/frege https://github.com/Frege/frege