-
Notifications
You must be signed in to change notification settings - Fork 109
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
Proto3 enums #137
Merged
Merged
Proto3 enums #137
Commits on Sep 7, 2017
-
Bundle enum pattern synonyms exports with their type.
This change removes support for `ghc-7.10`. The feature we're using was only added in `ghc-8.0.1`, and there are already a few other shims for that older version of GHC. This change uses explicit export lists in the generated proto modules (but only for `Proto.Foo.Bar`, not `Proto.Foo.Bar'Fields`). The same names should be exported as before, the only difference is that for enum aliases: ``` enum Foo { option allow_alias = true; Foo = 1; Bar = 2; BarA = 2; } ``` which produce the Haskell code: ``` data Foo = Foo | Bar pattern BarA :: Foo pattern BarA = Bar ``` we now export explicitly `Foo(.., BarA)`, rather than exporting `BarA` as a separate name. That way, if someone writes `import Proto.File (Foo(..))` then they also get `BarA` automatically.
Configuration menu - View commit details
-
Copy full SHA for 8605326 - Browse repository at this point
Copy the full SHA 8605326View commit details -
Implement proto3-style "open" enums.
For example: ``` enum Foo { Foo0 = 0; Foo1 = 1; } ``` becomes ``` newtype Foo = Foo Int32 pattern Foo0 :: Foo pattern Foo0 :: Foo 0 pattern Foo1 :: Foo pattern Foo1 :: Foo 1 ``` Additionally, proto3 enums are exported from the `Proto.*` module with the form `Foo(Foo0, Foo1)`, so that they can be imported as `Foo(..)` to get the patterns.
Configuration menu - View commit details
-
Copy full SHA for 176a5d5 - Browse repository at this point
Copy the full SHA 176a5d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for bccef23 - Browse repository at this point
Copy the full SHA bccef23View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d716f0 - Browse repository at this point
Copy the full SHA 1d716f0View commit details
Commits on Sep 8, 2017
-
Configuration menu - View commit details
-
Copy full SHA for da6d4db - Browse repository at this point
Copy the full SHA da6d4dbView commit details
Commits on Sep 12, 2017
-
Configuration menu - View commit details
-
Copy full SHA for 9d1a76d - Browse repository at this point
Copy the full SHA 9d1a76dView commit details -
Configuration menu - View commit details
-
Copy full SHA for eb4f5e4 - Browse repository at this point
Copy the full SHA eb4f5e4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d0974b - Browse repository at this point
Copy the full SHA 2d0974bView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.