PoC: Add json :: Shell Text -> Shell Value
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?
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?
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.
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
Okay, I'll translate the examples on jq website.