Created
August 1, 2015 21:52
-
-
Save searler/09f945fa6c7835f2b141 to your computer and use it in GitHub Desktop.
Using scodec discriminated/typecase to encode subtypes
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
val contents: Codec[Data] = discriminated[Data].by(ignore(0)) | |
.typecase((), empty) | |
.typecase((), XXX) | |
.typecase((), YYY) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment