Consider adding Json Pattern Functor
See original GitHub issue@travisbrown wondering if you’d agree to the addition in circe-core
of a Pattern Functor version of circe’s Json ADT, which is required when working with recursion-schemes. I’ve been using the code below in a few occurrences, maybe it’d be worth PR-ing ?
sealed trait JsonF[+A]
case object JNullF extends JsonF[Nothing]
case class JBooleanF(b: Boolean) extends JsonF[Nothing]
case class JNumberF(n: JsonNumber) extends JsonF[Nothing]
case class JStringF(s: String) extends JsonF[Nothing]
case class JArrayF[A](value: Vector[A]) extends JsonF[A]
case class JObjectF[A](fields: Vector[(String, A)]) extends JsonF[A]
object JsonF {
implicit val jsonTraverse : cats.Traverse[JsonF] = ???
val unfold : Json => JsonF[Json] = ???
val fold : JsonF[Json] => Json = ???
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Enhancing Functor Structures Step-By-Step (Part 1) - in Code
We want to be able to use our schema type and use it to parse information from a json value, of a given...
Read more >Functional Rephrasing Using an Async Function Functor
As a first pass, we could write a transform function that takes the url and applies each of these steps. async function transform(url)...
Read more >Is it valid to define functions in JSON results? - Stack Overflow
No. JSON is purely meant to be a data description language. As noted on http://www.json.org, it is a "lightweight data-interchange format.
Read more >JSON and XML Functors - Harness.io Docs
Harness includes JSON and XML functors you can use to select contents from JSON and XML sources. These functors reduce the amount of...
Read more >About the Ergonomics of Applicative JSON Decoding
I have a feeling that many Elm projects pull in NoRedInk/elm-json-decode-pipeline as a dependency. Even the docs for elm/json point to it.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Baccata Yes, this is something I’ve played with and have been meaning to add for a while—I really wanted to land the circe-algebra work first, but I don’t think that’s necessary. I’d merge a new modules adding this today, and would be happy to discuss where it would fit in core.
Done in #1092 (and the follow-up #1094).