Skip to content

Instantly share code, notes, and snippets.

Primarily working on

Bruce Eckel BruceEckel

Primarily working on
View GitHub Profile
View kmonad.kts
sealed class Bag<out THING> {
object Empty: Bag<Nothing>()
data class NonEmpty<out THING>(val thing: THING): Bag<THING>()
// Make a Bag with a THUNG in it
companion object {
fun <THUNG> make(thung: THUNG): Bag<THUNG> = NonEmpty(thung)
// Do stuff to the THING in the Bag by providing a thingToBagOfThang