A lens-based implementation of protocol buffers in Haskell.

Version on this page:
LTS Haskell 22.26:
Stackage Nightly 2024-06-21:
Latest on Hackage:

See all snapshots proto-lens appears in

BSD-3-Clause licensed by Judah Jacobson
Maintained by [email protected]
This version can be pinned in stack with:proto-lens-,1680

The proto-lens library provides to protocol buffers using modern Haskell language and library patterns. Specifically, it provides:

  • Composable field accessors via lenses

  • Simple field name resolution/overloading via type-level literals

  • Type-safe reflection and encoding/decoding of messages via GADTs


Changelog for proto-lens

Unreleased changes


  • Bump the dependency on base to support ghc-8.2.1.


  • Include base’s modules in the reexport list.
  • Use custom-setup in packages that depend on proto-lens-protoc.
  • Allow .proto files to import between Haskell packages.
  • Add the proto-lens-protobuf-types package.


  • Make the libraries ‘-Wall -Werror’-clean for the latest version of GHC.


  • Support OverloadedLabels with the new lens-labels package.
  • Fix codegen for field names that are already camel-cased.
  • Increase version bounds to work with Stackage lts-8.


  • Fix the handling of packed repeated fields (#38)
  • Improve space usage and time of decoding (#63)
  • Print fields ordered by tag number (#40)


  • Relaxed dependency constraints on data-default-class for new stackage LTS.


  • In printing and parsing protocol buffers use/interpret escape sequences in a way compatible with the Protocol Buffer distribution’s C/C++ escaping style, closing Issues #44 and #45. This makes the text output incompatible with previous versions; earlier versions will misinterpret text written by this version and this version will misinterpret text written by previous versions.
  • Support reading text protocol buffers with single quote characters (’) for string delimiters, closing Issue #20.


  • Expose more of protoc-gen-haskell to plugins.
  • Support enum aliases.
  • TextFormat prints enum names instead of numbers.


  • Support ghc-8.
  • Handle .proto files without a “package” declaration (#11).


  • Initial version.