alphaHeavy / protobuf

An implementation of Google's Protocol Buffers in Haskell.
http://hackage.haskell.org/package/protobuf
BSD 3-Clause "New" or "Revised" License
96 stars 18 forks source link

create haskell data from .proto message files (and vice versa) #9

Open ghorn opened 10 years ago

ghorn commented 10 years ago

The documentation mentions this is in the works already. It would be nice to have this, especially since the hprotoc project seems to be broken on ghc 7.8

NathanHowell commented 10 years ago

I disabled protoc-gen-hs in recent builds because it doesn't produce working output and it has a dependency on a pretty heavyweight library: haskell-src-exts. It would be great to get something that does work and uses explicit layout or a light weight pretty printer.

There is also a stub of a .proto generator that needs some love: src/Data/ProtocolBuffers/Ppr.hs. It was built against type-level and has experienced some bitrot since the 7.8 conversion. This should be significantly easier to get working than the Haskell codgen.

If you want to take a stab at either one I'm more than happy to accept pull requests.

YellowOnion commented 9 years ago

In the meantime, is there anyway to manually convert .proto to work with this library.

NathanHowell commented 9 years ago

@YellowOnion yes, you can manually translate messages in a .proto file into their protobuf equivalent records in Haskell... for example most of the records in https://github.com/alphaHeavy/protobuf/blob/master/plugin/Main.hs were translated from https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto