Skip to content

Instantly share code, notes, and snippets.

Bruce Eckel BruceEckel

Block or report user

Report or block BruceEckel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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
You can’t perform that action at this time.