package lambdabuffers

Mouse Melon logoGet desktop application:
View/edit binary Protocol Buffers messages

message ClassConstraint

lang.proto:409

Class constraints A special constraint type denoting the constraints that occur on the rhs of class definitions. Only used to specify super class constraints in a `ClassDef`. Not to be confused with `Constraint` which denote type class rules.

Used in: ClassDef

message ClassDef

lang.proto:386

Type class definition LambdaBuffers use type classes to talk about the various 'meanings' or 'semantics' we want to associate with the types in LambdaBuffers schemata. For instance, most types can have `Eq` semantics, meaning they can be compared for equality. Other can have `Ord` semantics, meaning they can be ordered. Using type classes and instance declarations, much like in Haskell, users can specify the 'meaning' of each type they declare. For example, serialization in LambdaBuffers is just another type class, it's treated the same as any other type class. Concretely, if we wish to provide JSON serialization for LambdaBuffers types, we declare such a type class and provide desired semantic rules: ```lbf module Foo class JSON a sum Foo a b = Bar a | Baz b derive JSON (Foo a b) ``` Note that for each type class introduced, the Codegen machinery must be updated to support said type class. In other words, it doesn't come for free and for each new type class, a Codegen support must be implemented for any `InstanceClause` declared by the user. Once all the `InstanceClause`s have an implementation provided, all the `Derive`d implementation come for free.

Used in: Module, compiler.ProtoParseError.MultipleClassDefError

message ClassName

lang.proto:188

Type class name

Used in: ClassDef, TyClassRef.Foreign, TyClassRef.Local, codegen.UnsupportedClassError, compiler.NamingError, compiler.TyClassCheckError.SuperclassCycleError

message ConstrName

lang.proto:172

Sum type constructor name

Used in: Sum.Constructor, compiler.NamingError

message Constraint

lang.proto:521

Constraint term

Used in: Derive, InstanceClause, compiler.TyClassCheckError.DeriveOpaqueError, compiler.TyClassCheckError.MissingRuleError, compiler.TyClassCheckError.OverlappingRulesError, compiler.TyClassCheckError.OverlappingRulesError.QHead

message Derive

lang.proto:515

Derive statement Derive statements enable user to specify 'semantic' rules for their types much like `InstanceClause`s do. However, the Codegen will be able to derive an implementation for any such constraint. ```lbf module Prelude class Eq a sum Maybe a = Just a | Nothing derive Eq (Maybe a) ``` The rule installed for the derive statement is: ```prolog eq(maybe(A)) :- eq(just(A) | Nothing). ``` The rule relates the desired `Ty` term to its (lambda calculus) 'evaluated' form. > Currently, there's only support for deriving type class rules and implementations for `Ty` terms of `Kind.KIND_REF_TYPE`. That means, type classes like Ord and Eq...

Used in: Module

message FieldName

lang.proto:180

Record type field name

Used in: Record.Field, compiler.NamingError

message InstanceClause

lang.proto:475

Instance clause Instance clauses enable users to specify ad-hoc 'semantic' rules for their types. Each such instance must be supported explicitly in the Codegen by providing runtime implementations. This rule form is used when declaring 'opaque' implementations on `Opaque` types. ```lbf module Prelude class Eq a opaque Maybe a instance Eq a => Eq (Maybe a) ``` The rule installed for the clause is: ```prolog eq(maybe(A)) :- eq(A). ``` The instance clause is verbatim added to the rule set.

Used in: Module

message Kind

lang.proto:247

Kinds A type of a type is called a 'kind'. In Lambda Buffers, all type terms, namely TyArg, TyVar, TyRef, TyApp and TyAbs, are either of kind `Type` or `Type -> Type` and `Type -> Type -> Type` etc.

Used in: Kind.KindArrow, TyArg, compiler.KindCheckError.InconsistentTypeError, compiler.KindCheckError.UnificationError

message Kind.KindArrow

lang.proto:256

A kind arrow.

Used in: Kind

enum Kind.KindRef

lang.proto:249

A built-in kind.

Used in: Kind

message Module

lang.proto:536

Module A module encapsulates type, class and instance definitions.

Used in: codegen.Input, compiler.Input, compiler.ProtoParseError.MultipleModuleError

message ModuleName

lang.proto:148

Module name

Used in: Module, TyClassRef.Foreign, TyRef.Foreign, codegen.UnsupportedClassError, codegen.UnsupportedOpaqueError, compiler.KindCheckError.CyclicKindError, compiler.KindCheckError.InconsistentTypeError, compiler.KindCheckError.UnboundTyRefError, compiler.KindCheckError.UnboundTyVarError, compiler.KindCheckError.UnificationError, compiler.ProtoParseError.MultipleClassDefError, compiler.ProtoParseError.MultipleConstructorError, compiler.ProtoParseError.MultipleFieldError, compiler.ProtoParseError.MultipleImportError, compiler.ProtoParseError.MultipleTyArgError, compiler.ProtoParseError.MultipleTyDefError, compiler.TyClassCheckError.DeriveOpaqueError, compiler.TyClassCheckError.ImportNotFoundError, compiler.TyClassCheckError.MissingRuleError, compiler.TyClassCheckError.OverlappingRulesError, compiler.TyClassCheckError.OverlappingRulesError.QHead, compiler.TyClassCheckError.SuperclassCycleError, compiler.TyClassCheckError.UnboundClassRefError

message ModuleNamePart

lang.proto:156

Module name part

Used in: ModuleName, compiler.NamingError

message Opaque

lang.proto:303

Opaque type. A type that has an `Opaque` body represents a 'built-in' or a 'primitive' type that's handled by the semantics 'under the hood'. It's called 'opaque' to denote the fact that the Compiler has no knowledge of its structure, and relies that the necessary knowledge is implemented elsewhere. The Codegen modules for any target language have to be able to handle such types specifically and map to existing value level representations and corresponding types. Codegen modules would have to implement support for such defined types, for example: - In Python `Set a` would map to `set()` from the standard library, - In Haskell `Set a` would map to `containers`.Data.Set.Set type. Every `Opaque` type has to be considered deliberately for each language environment targeted by Codegen modules. TODO(bladyjoker): Consider attaching explicit Kind terms to Opaques.

Used in: TyBody

message Product

lang.proto:332

A product type term.

Used in: Sum.Constructor, TyBody

message Record

lang.proto:340

A record type term.

Used in: TyBody

message Record.Field

lang.proto:342

Field in a record type.

Used in: Record, compiler.ProtoParseError.MultipleFieldError

message SourceInfo

lang.proto:11

Frontend Source information Frontends are advised to include *Source* information to denote how their Source* content maps to the *Compiler Input*. It's essential when reporting Compiler* errors back to the Frontend.

Used in: ClassDef, ClassName, ConstrName, Constraint, FieldName, InstanceClause, Module, ModuleName, ModuleNamePart, Opaque, Product, Record, Sum, TyAbs, TyApp, TyArg, TyClassRef.Foreign, TyClassRef.Local, TyDef, TyName, TyRef.Foreign, TyRef.Local, VarName, codegen.InternalError, compiler.InternalError

message SourcePosition

lang.proto:21

Position in Source

Used in: SourceInfo

message Sum

lang.proto:313

A sum type term. A type defined as a Sum type is just like a Haskell algebraic data type and represents a sum of products.

Used in: TyBody

message Sum.Constructor

lang.proto:315

Constructor of a Sum type is a Product type term.

Used in: Sum, compiler.ProtoParseError.MultipleConstructorError

message Ty

lang.proto:52

Type term A type term that occurs in bodies of type definitions (message TyDef): ```lbf sum Maybe a = Just a | Nothing sum Either a b = Left a | Right b sum SomeType a = Foo a (Maybe a) | Bar (Either (Maybe a) (SomeType a)) ``` or in instance declarations: ```lbf instance Eq (Maybe a) instance Eq (SomeType Int) instance (Eq (Maybe a), Eq (SomeType a)) Eq (Either (Maybe a) (SomeType a)) ``` Check out [examples](examples/tys.textproto).

Used in: Constraint, Product, Record.Field, TyApp, Tys

message TyAbs

lang.proto:76

Type abstraction A type term that introduces type abstractions (ie. type functions). This type term can only be introduced in the context of a [type definition](@ref TyDef).

Used in: TyDef

message TyApp

lang.proto:93

Type application A type term that applies a type abstraction to a list of arguments.

Used in: Ty

message TyArg

lang.proto:231

Type arguments Arguments in type abstractions. Type arguments and therefore type variables have kinds, the Compiler only accepts `Type` kinded type arguments ans therefore type variables. However, to allow for future evolution if ever necessary, we attach the Kind term to type arguments, even though the Compiler will reject any TyArg that's not of kind `Type`. Note, this effectively means that lambda Buffers doesn't support higher-kinded types (ie. HKT).

Used in: ClassDef, TyAbs, compiler.ProtoParseError.MultipleTyArgError

message TyBody

lang.proto:274

Type body. Lambda Buffers type bodies type terms that can only be specified in the `TyAbs` context. It's a built-in type term that can only occur enclosed within a `TyAbs` term which introduces `TyVar`s in the scope of the term.

Used in: TyAbs

message TyClassRef

lang.proto:422

Type class references It is necessary to know whether a type class is defined locally or in a foreign module when referring to it in a constraint, this allows users (and requires the frontend) to explicitly communicate that information.

Used in: ClassConstraint, Constraint, compiler.TyClassCheckError.SuperclassCycleError, compiler.TyClassCheckError.UnboundClassRefError

message TyClassRef.Foreign

lang.proto:431

Foreign class reference.

Used in: TyClassRef

message TyClassRef.Local

lang.proto:424

Local type reference.

Used in: TyClassRef

message TyDef

lang.proto:208

Type definition A type definition consists of a type name and its associated type term. One way to look at it is that a type definition introduces a named 'type abstraction' in the module scope. Concretely, `Either` can be considered a type lambda of kind `Type -> Type -> Type`. In fact, type definitions are the only way to introduce such types. Once introduced in the module scope, type definitions are referred to using [TyRef](@ref TyRef) term.

Used in: Module, compiler.KindCheckError.CyclicKindError, compiler.KindCheckError.InconsistentTypeError, compiler.KindCheckError.UnboundTyRefError, compiler.KindCheckError.UnboundTyVarError, compiler.KindCheckError.UnificationError, compiler.ProtoParseError.MultipleConstructorError, compiler.ProtoParseError.MultipleFieldError, compiler.ProtoParseError.MultipleTyArgError, compiler.ProtoParseError.MultipleTyDefError

message TyName

lang.proto:140

Type name

Used in: TyDef, TyRef.Foreign, TyRef.Local, codegen.UnsupportedOpaqueError, compiler.NamingError

message TyRef

lang.proto:108

Type reference A type term that denotes a reference to a type available that's declared locally or in foreign modules.

Used in: Ty, compiler.KindCheckError.UnboundTyRefError

message TyRef.Foreign

lang.proto:117

Foreign type reference.

Used in: TyRef

message TyRef.Local

lang.proto:110

Local type reference.

Used in: TyRef

message TyVar

lang.proto:65

Type variable

Used in: ClassConstraint, Ty, compiler.KindCheckError.UnboundTyVarError

message Tys

lang.proto:133

A list of type terms useful for debugging

message VarName

lang.proto:164

Type variable name

Used in: TyArg, TyVar, compiler.NamingError