To my knowledge, Haskell has no solution for null, since it neither has null, not it has mutable state. Instead, Haskell is lazily evaluated language. Haskell’s lazy evaluation does avoid both nulls and initialization problems altogether, but it is not quite a pragmatic approach. However, if that is what you are looking for, then you can totally program in Haskell style using Kotlin by wrapping all your types into Lazy<T> and wrapping all your expressions into lazy { ... }. This way you’ll get Haskell-like behavior and would not need any nulls. All in all, it has not nothing to do with JVM, but with your programming paradigm. There are several Haskell-like lazy-evaluated languages running on JVM, if you wish.

Written by

Project Lead for the Kotlin Programming Language @JetBrains

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store