question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
travisbrowncommented, Mar 2, 2019

@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.

0reactions
travisbrowncommented, Mar 10, 2019

Done in #1092 (and the follow-up #1094).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found