Created
September 9, 2023 02:16
-
-
Save rinotc/b627dde67a7e16358cf677ecac1a347c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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