Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d6y/argonaut-sealed-sum
JSON Sum Type Example Using argonaut-shapeless
https://github.com/d6y/argonaut-sealed-sum
Last synced: about 1 month ago
JSON representation
JSON Sum Type Example Using argonaut-shapeless
- Host: GitHub
- URL: https://github.com/d6y/argonaut-sealed-sum
- Owner: d6y
- Created: 2015-03-07T15:04:15.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-07T15:04:29.000Z (almost 10 years ago)
- Last Synced: 2023-03-10T19:08:47.918Z (almost 2 years ago)
- Language: Scala
- Size: 102 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON Sum Type Example Using argonaut-shapeless
A short example of a Shape sealed trait with a Circle and Square instance,
which is encoded to and from JSON, and a function applied to compute
the area for the heck of it.$ sbt
> run
[info] Running code.Main
The circle in JSON: {"Circle":{"radius":100}}
The JSON encoded as a Shape: DecodeResult(\/-(Circle(100)))
Square area: DecodeResult(\/-(2500.0))
Circle area: DecodeResult(\/-(31415.926535897932))## Links
* [Automatic argonaut codec derivation with shapeless](https://github.com/alexarchambault/argonaut-shapeless)