-
Notifications
You must be signed in to change notification settings - Fork 30
Add more details contrasting fromString and jsonParser
#45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -185,8 +185,12 @@ foreign import fromBoolean :: Boolean -> Json | |||||
| -- | Construct `Json` from a `Number` value | ||||||
| foreign import fromNumber :: Number -> Json | ||||||
|
|
||||||
| -- | Construct `Json` from a `String` value. If you would like to parse a string | ||||||
| -- | of JSON into valid `Json`, see `jsonParser`. | ||||||
| -- | Construct `Json` from a `String` value. | ||||||
| -- | Note that this function only produces a `Json` object containing a single piece of `String` | ||||||
|
||||||
| -- | data (similar to `fromBoolean`, `fromNumber`, etc.). These "fromX" functions are often | ||||||
| -- | used to build-up JSON objects manually, as opposed to using `encodeJson`. | ||||||
| -- | This function does NOT convert the `String` encoding of a JSON object to `Json` - For that | ||||||
|
||||||
| -- | This function does NOT convert the `String` encoding of a JSON object to `Json` - For that | |
| -- | This function does NOT parse a string of JSON data into the equivalent `Json` -- for that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little wary of using the term 'object' here as it may lead a reader to believe this only applies to literal objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to mention this, but I'd like to take out this line:
These "fromX" functions are often used to build-up JSON objects manually, as opposed to using
encodeJson.
as there are more libraries for working with JSON than argonaut-codecs (even though it's the one bundled in to the 'argonaut ecosystem') and this library is more of a common base JSON type and utility functions for any other JSON libraries to work with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be clearer if it said "Construct a
Jsonstring from aStringvalue" to make it clear it's just producing a string, and not bonafide JSON with strings, numbers, objects, etc.?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"
Jsonstring" makes me think it produces the string representation of the json contents - like what you'd get fromstringify.What about changing to: "Construct the
Jsonrepresentation of aStringvalue"?I feel like the output is still bona fide JSON, even if it's very simple JSON in this case.
Also, if we change that first line, we should probably change all the other
fromXdocs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with that phrasing. And you're right, it's still bona fide JSON.