Skip to content

Instantly share code, notes, and snippets.

@rinotc
Created September 9, 2023 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rinotc/b627dde67a7e16358cf677ecac1a347c to your computer and use it in GitHub Desktop.
Save rinotc/b627dde67a7e16358cf677ecac1a347c to your computer and use it in GitHub Desktop.
class Sample[M <: Mode] private (val value: Int) {
def setValue(v: Int)(implicit ev: M =:= Write) = new Sample[M](v)
}
object Sample {
def asWrite(value: Int): Sample[Write] = new Sample[Write](value)
def asRead(value: Int): Sample[Read] = new Sample[Read](value)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment