turtle icon indicating copy to clipboard operation
turtle copied to clipboard

PoC: Add json :: Shell Text -> Shell Value

Open maoe opened this issue 9 years ago • 4 comments

I came up with an idea to stream texts into JSON values. It's still a PoC as I do have a use case but I haven't actually tried it yet.

Some concerns:

  • The extra dependencies might be a concern. Worth a separate package?
  • We may want to use Aeson.value' instead
  • We may want to define a function that is of type FromJSON a => Shell Text -> Shell a
  • The error ignorance may not be a good idea in some cases

What do you think?

maoe avatar Aug 22 '16 07:08 maoe

My rough rule of thumb for what should go into the library is whether there is some equivalent Unix utility. Is there some Unix analog of this functionality?

Gabriella439 avatar Aug 23 '16 03:08 Gabriella439

Well, that's a good question. I think the jq command is somewhat similar in the sense that it parses texts as JSON objects. jq has a query language to look up or edit the parsed JSON objects. We can do similar things with lens-aeson for example.

maoe avatar Aug 23 '16 04:08 maoe

So I think that jq-like functionality is desirable, but I would like to see some examples of how to translate various jq idioms to Haskell

Gabriella439 avatar Aug 26 '16 16:08 Gabriella439

Okay, I'll translate the examples on jq website.

maoe avatar Aug 29 '16 23:08 maoe