google / proto-lens

API for protocol buffers using modern Haskell language and library patterns.
https://google.github.io/proto-lens
BSD 3-Clause "New" or "Revised" License
462 stars 109 forks source link

Generate Haddock from C-style comments #200

Open FintanH opened 6 years ago

FintanH commented 6 years ago

I was mulling over protobuf documentation. I thought it would be nice if the C-style comments could turn into Haddock documentation for messages and possibly their fields. I dunno how possible this is though.

judah commented 6 years ago

This ought to be possible in principle. The descriptor proto message that we get from protoc has the comments attached to individual entities via SourceCodeInfo: https://github.com/google/protobuf/blob/b40cb4bc8bd233330cba2ab09d6e3016b004dce0/src/google/protobuf/descriptor.proto#L728 Seems like we could parse them out into Haddocks, possibly escaping any special Haddock characters.