Please don’t rely on this Gitea instance being around forever. If any of your build scripts use my (kageru’s) projects hosted here, check my Github or IEW on Github for encoding projects. If you can’t find what you’re looking for there, tell me to migrate it.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kageru 5b3b6a28fb
update readme
2 years ago
Option.kt initial commit 2 years ago
OptionTest.kt initial commit 2 years ago update readme 2 years ago

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.


An implementation of an Option<A> type in Kotlin using the inline class feature. See

Its just a small proof of concept sparked by the discussion on the arrow-kt issue tracker after they decided to deprecate Option because nullable types are more efficient. Its just a single file, so 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 dont think those are ever a good idea to have, but I saw no reason not to support them.