proto3-suite-0.4.2: A low level library for writing out data in the Protocol Buffers wire format
Safe HaskellNone
LanguageHaskell2010

Proto3.Suite.DotProto.Generate

Description

This module provides functions to generate Haskell declarations for protobuf messages

Synopsis

Documentation

type TypeContext = Map DotProtoIdentifier DotProtoTypeInfo Source #

A mapping from .proto type identifiers to their type information

compileDotProtoFile :: CompileArgs -> IO (Either CompileError ()) Source #

Generate a Haskell module corresponding to a .proto file

compileDotProtoFileOrDie :: CompileArgs -> IO () Source #

Same as compileDotProtoFile, except terminates the program with an error message on failure.

hsModuleForDotProto Source #

Arguments

:: MonadError CompileError m 
=> ([HsImportDecl], [HsDecl])

Extra user-define instances that override default generated instances

-> DotProto 
-> TypeContext 
-> m HsModule 

Compile a Haskell module AST given a DotProto package AST. Instances given in eis override those otherwise generated.

renderHsModuleForDotProto :: MonadError CompileError m => ([HsImportDecl], [HsDecl]) -> DotProto -> TypeContext -> m String Source #

Compile a DotProto AST into a String representing the Haskell source of a module implementing types and instances for the .proto messages and enums.

readDotProtoWithContext :: (MonadError CompileError m, MonadIO m) => [FilePath] -> FilePath -> m (DotProto, TypeContext) Source #

Parses the file at the given path and produces an AST along with a TypeContext representing all types from imported .proto files, using the first parameter as a list of paths to search for imported files. Terminates with exit code 1 when an included file cannot be found in the search path.