Skip to content

Instantly share code, notes, and snippets.

@cdsap
Created April 5, 2019 14:43
Show Gist options
  • Save cdsap/4ef8b7ecb3dbe808fa6b07b8c7adc9d7 to your computer and use it in GitHub Desktop.
Save cdsap/4ef8b7ecb3dbe808fa6b07b8c7adc9d7 to your computer and use it in GitHub Desktop.
StarWars
/*
I am your Father Luke
*/
sealed class Pronouns {
object I : Pronouns()
object You : Pronouns()
}
sealed class PronounsPer {
object Your : PronounsPer()
object My : PronounsPer()
}
sealed class Characters {
object Luke : Characters()
object Leila : Characters()
}
infix fun Pronouns.I.am(value: PronounsPer) = Wrapper(this)
infix fun Pronouns.You.are(value: PronounsPer) = Wrapper(this)
class Wrapper(val pronouns: Pronouns) {
infix fun Father(characters: Characters) =
pronouns == Pronouns.I && characters == Characters.Luke
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment