Skip to content
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

Improve the field-related documentation/API #158

Closed
judah opened this issue Dec 7, 2017 · 3 comments
Closed

Improve the field-related documentation/API #158

judah opened this issue Dec 7, 2017 · 3 comments

Comments

@judah
Copy link
Collaborator

judah commented Dec 7, 2017

Some related changes to help simplify the API around fields in proto-lens:

  • Hide the constructors for proto messages. They're even less useful than before now that we have unknown fields. (Developers can still click source in the Haddock docs to see the underlying implementation.)

  • Make the Show instance not display the internal fields, instead using the text format, for example:

    showsPrec _ x = showChar '{' . showString (showMessageShort x) . showChar '}' 
    
  • Add Haddock comments for every proto message that list the names and types of all available lenses. Note: this is a little tricky (but doable) since haskell-src-exts doesn't easily support inserting top-level comments. (Note: include the accessor for unknown fields.)

@judah judah changed the title Simplify field-related documentation/API Improve the field-related documentation/API Dec 7, 2017
@judah
Copy link
Collaborator Author

judah commented Aug 21, 2018

Update: we already have field-level Haddock comments; the rest is happening in #174.

@blackgnezdo
Copy link
Collaborator

Is this issue ready to be closed now?

@judah
Copy link
Collaborator Author

judah commented Aug 25, 2018

We can close it after #174 gets merged.

judah added a commit that referenced this issue Aug 26, 2018
Finishes #158.

They're not that useful for constructing values (especially after adding the
"unknown fields" case) and were previously mostly used for documentation.  Now
that #172 has landed, we have a better source of documentation that doesn't
expose internal details.

Also change the `Show` instance for messages to be a wrapper around
`showMessageShort`.  This both hides the now-inaccessible record fields and
shortens the output in most cases.  For example:

```
> print (def :: DescriptorProto)
{}
> print (def & #name .~ "hello" & #field .~ [def, def & #name .~ "bye"]:: DescriptorProto)
{name: "hello" field { } field { name: "bye" }}
```

Also bump the resolver for bootstrapping to match the regular build.
@judah judah closed this as completed Aug 26, 2018
avdv pushed a commit to avdv/proto-lens that referenced this issue Aug 9, 2023
…#174)

Finishes google#158.

They're not that useful for constructing values (especially after adding the
"unknown fields" case) and were previously mostly used for documentation.  Now
that google#172 has landed, we have a better source of documentation that doesn't
expose internal details.

Also change the `Show` instance for messages to be a wrapper around
`showMessageShort`.  This both hides the now-inaccessible record fields and
shortens the output in most cases.  For example:

```
> print (def :: DescriptorProto)
{}
> print (def & #name .~ "hello" & #field .~ [def, def & #name .~ "bye"]:: DescriptorProto)
{name: "hello" field { } field { name: "bye" }}
```

Also bump the resolver for bootstrapping to match the regular build.
ylecornec pushed a commit to ylecornec/proto-lens that referenced this issue Feb 19, 2024
…#174)

Finishes google#158.

They're not that useful for constructing values (especially after adding the
"unknown fields" case) and were previously mostly used for documentation.  Now
that google#172 has landed, we have a better source of documentation that doesn't
expose internal details.

Also change the `Show` instance for messages to be a wrapper around
`showMessageShort`.  This both hides the now-inaccessible record fields and
shortens the output in most cases.  For example:

```
> print (def :: DescriptorProto)
{}
> print (def & #name .~ "hello" & #field .~ [def, def & #name .~ "bye"]:: DescriptorProto)
{name: "hello" field { } field { name: "bye" }}
```

Also bump the resolver for bootstrapping to match the regular build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants