Roman Elizarov
1 min readFeb 17, 2019

--

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.

--

--

Roman Elizarov
Roman Elizarov

Written by Roman Elizarov

Project Lead for the Kotlin Programming Language @JetBrains

Responses (3)