Go to file
2020-10-02 16:13:26 +02:00
Option.kt initial commit 2020-10-02 16:13:26 +02:00
OptionTest.kt initial commit 2020-10-02 16:13:26 +02:00
README.md initial commit 2020-10-02 16:13:26 +02:00

inline-option

An implementation of an Option<A> type in Kotlin using the inline class feature. See https://kotlinlang.org/docs/reference/inline-classes.html

It’s just a small proof of concept which is why I decided to omit the usual gradle bloat. Build and test via:

$ kotlinc-native Option.kt OptionTest.kt
$ ./program.kexe

The implementation uses an empty value placeholder to allow for nullable types (i.e. Option<Int?>). I don’t think those are ever a good idea to have, but I saw no reason not to support them.