Get desktop application:
View/edit binary Protocol Buffers messages
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:
Type class reference.
Type variables quantified over `ClassDef` arguments.
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: ,
Type class name.
Type class arguments. Class with no arguments is a trivial class. Compiler MAY report an error. TODO(bladyjoker): MultipleClassArgError.
Superclass constraints.
Documentation elaborating on the type class.
Source information.
Type class name
Used in: , , , , ,
Name ::= [A-Z]+[A-Za-z0-9_]*
Source information.
Sum type constructor name
Used in: ,
Name ::= [A-Z]+[A-Za-z0-9_]*
Source information.
Constraint term
Used in: , , , , ,
Name of the type class.
Constraint arguments. Constraint with no arguments is a trivial constraint. Compiler MAY report an error.
Source information.
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:
Constraint to derive.
Record type field name
Used in: ,
Name ::= [a-z]+[A-Za-z0-9_]*
Source information.
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:
Head of the clause that holds only when the `body` holds. Type variables introduced in the head of the rule become available in the scope of the body of the rule.
Instance (rule) body, conjunction of constraints.
Source information.
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 built-in reference or a kind arrow.
A kind arrow.
Used in:
A built-in kind.
Used in:
Unspecified kind SHOULD be inferred by the Compiler.
A `Type` kind (also know as `*` in Haskell) built-in.
Module A module encapsulates type, class and instance definitions.
Used in: , ,
Module name.
Type definitions. Duplicate type definitions MUST be reported with `ProtoParseError.MultipleTyDefError`.
Type class definitions. Duplicate class definitions MUST be reported with `ProtoParseError.MultipleClassDefError`.
Type class instance clauses.
Type class derive statements.
Imported modules the Compiler consults when searching for type class rules. TODO(bladyjoker): Rename to ruleImports. Duplicate imports MUST be reported with `ProtoParseError.MultipleImportError`.
Source information.
Module name
Used in: , , , , , , , , , , , , , , , , , , , , , ,
Parts of the module name denoting a hierarchical namespace.
Source information.
Module name part
Used in: ,
Name ::= [A-Z]+[A-Za-z0-9_]*
Source information.
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:
Source information.
A product type term.
Used in: ,
Fields in a products are types.
Source information.
A record type term.
Used in:
Record fields.
Source information.
Field in a record type.
Used in: ,
Record field name.
Field type.
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: , , , , , , , , , , , , , , , , , , , , , , , ,
A filename denoting the Source file.
Starting position in Source.
End position in Source.
Position in Source
Used in:
Column index in the Source.
Row index in the Source.
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:
Sum type constructors. Empty `constructors` means `void` and means that the type can't be constructed. Compiler MAY report an error. Duplicate constructors MUST be reported with `ProtoParseError.MultipleConstructorError`.
Source information.
Constructor of a Sum type is a Product type term.
Used in: ,
Constructor name.
Product type term.
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: , , , ,
A type variable, a type reference or a type application.
A type variable.
A type application.
A type reference.
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:
List of type variables. No type arguments means `delay` or `const ty_body`, meaning `TyAbs [] ty_body = ty_body`. Duplicate type arguments MUST be reported with `ProtoParseError.MultipleTyArgError`.
Type body.
Source information.
Type application A type term that applies a type abstraction to a list of arguments.
Used in:
Type function. TODO(bladyjoker): Rename to ty_abs?
Arguments to apply. No arguments to apply means `force`, meaning `TyApp ty_func [] = ty_func``
Source information.
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: , ,
Argument name corresponds to variable names.
Argument kind.
Source information.
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:
Either an opaque, a sum/product/record type term.
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: , , ,
Local or a foreign type class reference.
Foreign class reference.
Used in:
Foreign module class name.
Foreign module name.
Source information.
Local type reference.
Used in:
Local module class name.
Source information.
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: , , , , , , , , ,
Type name.
Type term.
Source information.
Type name
Used in: , , , ,
Name ::= [A-Z]+[A-Za-z0-9_]*
Source information.
Type reference A type term that denotes a reference to a type available that's declared locally or in foreign modules.
Used in: ,
Local or a foreign type reference.
Foreign type reference.
Used in:
Foreign module type name.
Foreign module name.
Source information.
Local type reference.
Used in:
Local module type name.
Source information.
Type variable
Used in: , ,
Variable name.
A list of type terms useful for debugging
Type variable name
Used in: , ,
Name ::= [a-z]+
Source information.