-
Notifications
You must be signed in to change notification settings - Fork 108
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
Field comments #172
Field comments #172
Conversation
…eir long-form variants.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
CLA ping -- bot should now rubberstamp. |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
Confirming that I am OK with my commit being used here. |
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.
A couple small comments; also, please take a look at the two errors in CI (let me know if you have trouble reproducing them): https://travis-ci.org/google/proto-lens/builds/331017983?utm_source=github_status&utm_medium=notification
@@ -28,7 +28,10 @@ import Data.String (fromString) | |||
import Data.Text (unpack) | |||
import qualified Data.Text as T | |||
import Data.Tuple (swap) | |||
import qualified Language.Haskell.Exts.Syntax as Syntax |
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.
Don't import this module directly; we're intentionally using the Combinators module as a shim. If necessary, add more exports to that module instead.
In particular, you can get ModuleName
from it: https://github.com/google/proto-lens/blob/master/proto-lens-protoc/src/Data/ProtoLens/Compiler/Combinators.hs#L218
messageComment :: Name -> [RecordField] -> String | ||
messageComment n fields = unlines | ||
messageComment :: Syntax.ModuleName () -> Name -> [RecordField] -> String | ||
messageComment (Syntax.ModuleName _ fieldModName) n fields = unlines |
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.
ModuleName
is an instance of Pretty
, so I believe you can just use prettyPrint
here instead of unwrapping the constructor.
Fixed all.
…On Mon, Jan 22, 2018 at 12:27 PM, Judah Jacobson ***@***.***> wrote:
***@***.**** requested changes on this pull request.
A couple small comments; also, please take a look at the two errors in CI
(let me know if you have trouble reproducing them):
https://travis-ci.org/google/proto-lens/builds/331017983?
utm_source=github_status&utm_medium=notification
------------------------------
In proto-lens-protoc/src/Data/ProtoLens/Compiler/Generate.hs
<#172 (comment)>:
> @@ -28,7 +28,10 @@ import Data.String (fromString)
import Data.Text (unpack)
import qualified Data.Text as T
import Data.Tuple (swap)
+import qualified Language.Haskell.Exts.Syntax as Syntax
Don't import this module directly; we're intentionally using the
Combinators module as a shim. If necessary, add more exports to that module
instead.
In particular, you can get ModuleName from it: https://github.com/google/
proto-lens/blob/master/proto-lens-protoc/src/Data/ProtoLens/Compiler/
Combinators.hs#L218
------------------------------
In proto-lens-protoc/src/Data/ProtoLens/Compiler/Generate.hs
<#172 (comment)>:
> @@ -165,15 +168,16 @@ reexported ***@***.*** {importModule = m}
where
m' = fromString $ "Data.ProtoLens.Reexport." ++ prettyPrint m
-messageComment :: Name -> [RecordField] -> String
-messageComment n fields = unlines
+messageComment :: Syntax.ModuleName () -> Name -> [RecordField] -> String
+messageComment (Syntax.ModuleName _ fieldModName) n fields = unlines
ModuleName is an instance of Pretty, so I believe you can just use
prettyPrint here instead of unwrapping the constructor.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#172 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfCrwmP7yQGTGfLWshGCWXS2X-RUsARUks5tNMTugaJpZM4RlIf7>
.
--
Christian Lavoie
christian.lavoie@takt.com
|
Now that we define our own `Module` type (google#172), we don't need `getModuleName` to return a `Maybe`.
Now that we define our own `Module` type (#172), we don't need `getModuleName` to return a `Maybe`.
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 `showMessageShow`. 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. Hide message constructors. showsPrec, and bootstrap
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 `showMessageShow`. 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. Hide message constructors. showsPrec, and bootstrap
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. Hide message constructors. showsPrec, and bootstrap
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. Hide message constructors. showsPrec, and bootstrap
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. Hide message constructors. showsPrec, and bootstrap
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.
Add haddock comments which give better documentation for fields lens docs for fields and link them to their long-form variants.
Now that we define our own `Module` type (google#172), we don't need `getModuleName` to return a `Maybe`.
…#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.
Add haddock comments which give better documentation for fields lens docs for fields and link them to their long-form variants.
…#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.
Revive @judah 's old field-comments branch, and prettify the output a wee bit.
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)