proto-lens-protoc-0.2.0.1: Protocol buffer compiler for the proto-lens library.

Safe HaskellNone
LanguageHaskell2010

Data.ProtoLens.Compiler.Definitions

Description

This module takes care of collecting all the definitions in a .proto file and assigning Haskell names to all of the defined things (messages, enums and field names).

Synopsis

Documentation

type Env n = Map Text (Definition n) Source #

Env contains a mapping of proto names (as specified in the .proto file) to Haskell names. The keys are fully-qualified names, for example, ".package.Message.Submessage". (The protocol_compiler tool emits all message field types in this form, even if they refer to local definitions.)

The type n can be either a Name (when talking about definitions within the current file) or a (qualified) QName (when talking about definitions either from this or another file).

data Definition n Source #

Constructors

Message (MessageInfo n) 
Enum (EnumInfo n) 

Instances

Functor Definition Source # 

Methods

fmap :: (a -> b) -> Definition a -> Definition b #

(<$) :: a -> Definition b -> Definition a #

data MessageInfo n Source #

All the information needed to define or use a proto message type.

Constructors

MessageInfo 

Fields

Instances

Functor MessageInfo Source # 

Methods

fmap :: (a -> b) -> MessageInfo a -> MessageInfo b #

(<$) :: a -> MessageInfo b -> MessageInfo a #

data FieldInfo Source #

Information about a single field of a proto message.

Constructors

FieldInfo 

Fields

data EnumInfo n Source #

All the information needed to define or use a proto enum type.

Instances

Functor EnumInfo Source # 

Methods

fmap :: (a -> b) -> EnumInfo a -> EnumInfo b #

(<$) :: a -> EnumInfo b -> EnumInfo a #

data EnumValueInfo n Source #

Information about a single value case of a proto enum.

Constructors

EnumValueInfo 

Fields

Instances

collectDefinitions :: FileDescriptorProto -> Env Name Source #

Collect all the definitions in the given file (including definitions nested in other messages), and assign Haskell names to them.

definedFieldType :: FieldDescriptorProto -> Env QName -> Definition QName Source #

Look up the type definition for a given field.