HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleproto-lens-setup-0.4.0.9Haskell2010

Data.ProtoLens.Setup

Helper functions to generate proto files as part of a Setup.hs script.

These functions assume that the proto-lens-protoc executable is on the PATH, and throw an exception otherwise. That executable will be installed automatically as part of installing this package; in particular, it should be enough to just list `proto-lens-protoc` in a user package's `build-dependencies`.

See README.md for instructions on how to use proto-lens with Cabal.

  • 6 values
valuedefaultMainGeneratingProtos
  1. :: FilePath

    The root directory under which .proto files can be found.

  2. -> IO ()
#

This behaves the same as defaultMain, but auto-generates Haskell files from .proto files which are:

  • Listed in the .cabal file under extra-source-files,

  • Located under the given root directory, and

  • Correspond to a module ("Proto.*") in `exposed-modules` or `other-modules` of some component in the .cabal file.

Writes the generated files to the autogen directory (dist/build/autogen for Cabal, and .stack-work/dist/.../build/autogen for stack).

Throws an exception if the proto-lens-protoc executable is not on the PATH.

valuedefaultMainGeneratingSpecificProtos
  1. :: FilePath

    The root directory under which .proto files can be found.

  2. -> (LocalBuildInfo -> IO [FilePath])

    A function to return a list of .proto files. Takes the Cabal package description as input. Non-absolute paths are treated as relative to the provided root directory.

  3. -> IO ()
#

This behaves the same as defaultMain, but auto-generates Haskell files from the .proto files listed. The given .proto files should be under the given root directory.

Writes the generated files to the autogen directory (dist/build/autogen for Cabal, and .stack-work/dist/.../build/autogen for stack).

Throws an exception if the proto-lens-protoc executable is not on the PATH.

valuegeneratingProtos
  1. :: FilePath

    The root directory under which .proto files can be found.

  2. -> UserHooks
  3. -> UserHooks
#

Augment the given UserHooks to auto-generate Haskell files from the .proto files which are:

  • Listed in the .cabal file under extra-source-files,

  • Located under the given root directory, and

  • Correspond to a module ("Proto.*") in `exposed-modules` or `other-modules` of some component in the .cabal file.

Writes the generated files to the autogen directory (dist/build/autogen for Cabal, and .stack-work/dist/.../build/autogen for stack).

Throws an exception if the proto-lens-protoc executable is not on the PATH.

valuegeneratingSpecificProtos
  1. :: FilePath

    The root directory under which .proto files can be found.

  2. -> (LocalBuildInfo -> IO [FilePath])

    A function to return a list of .proto files. Takes the Cabal package description as input. Non-absolute paths are treated as relative to the provided root directory.

  3. -> UserHooks
  4. -> UserHooks
#

Augment the given UserHooks to auto-generate Haskell files from the .proto files returned by a function getProtos.

Writes the generated files to the autogen directory (dist/build/autogen for Cabal, and .stack-work/dist/.../build/autogen for stack).

Throws an exception if the proto-lens-protoc executable is not on the PATH.

valuegenerateProtosWithImports
  1. :: [FilePath]

    Directories under which .proto files and/or files that they import can be found.

  2. -> FilePath

    The output directory for the generated Haskell files.

  3. -> [FilePath]

    The .proto files to process.

  4. -> IO ()
#

Run the proto compiler to generate Haskell files from the given .proto files.

Writes the generated files to the autogen directory (dist/build/autogen for Cabal, and .stack-work/dist/.../build/autogen for stack).

Throws an exception if the proto-lens-protoc executable is not on the PATH.

valuegenerateProtos
  1. :: FilePath

    The root directory under which .proto files can be found.

  2. -> FilePath

    The output directory for the generated Haskell files.

  3. -> [FilePath]

    The .proto files to process.

  4. -> IO ()
#

Run the proto compiler to generate Haskell files from the given .proto files.

Writes the generated files to the autogen directory (dist/build/autogen for Cabal, and .stack-work/dist/.../build/autogen for stack).

Throws an exception if the proto-lens-protoc executable is not on the PATH.