Skip to content
GraphLambda Help Graph-native functional programming
05 / Types

Types travel with the values

GraphLambda checks integers, Booleans and function types before execution. Socket shapes and wire geometry make those distinctions visible.

The type language

Int
Bool
Int -> Int
(Int -> Int) -> Int

Function arrows associate to the right: Int -> Bool -> Int means Int -> (Bool -> Int) . Lambda parameters and recursive binders carry declarations; the checker solves the remaining port constraints. The language is monomorphic: local type variables in unfinished nodes are constraints to solve, not user-defined polymorphic functions.

Sockets and wires

Type Socket silhouette Wire
Int Square Single solid line
Bool Diamond Single dashed line
Function Hexagon Doubled rail, with its function type
Unresolved Round / rounded socket notation Fine dotted line

These shapes depend on the port’s type, not the producer’s node kind. Application can return either data or a function. Arrowheads identify flow; colours are supplementary, so shape and line style continue to distinguish values in monochrome.

What a valid connection requires

Construct Constraint
Add, Subtract, Multiply Both inputs and the result are Int.
Less Both inputs are Int; the result is Bool.
Application If the function has type A -> B, the argument has type A and the result has type B.
If Condition is Bool; both branches and the result have one common type.
Lambda Parameter has declared type A; the body determines B; the function has type A -> B.
LetRec The recursive declaration is a function type matching the definition Lambda.
Output Its input carries the result type of the program.

For example, connect an Int -> Int function to Application, then try a Bool argument. The connection is refused. The same type constraints apply to a text draft submitted through Update Flowchart.

Inspect and edit declarations

Select a node or wire, then open Type / Properties . Intrinsic signatures, such as Add’s integer inputs, are reported rather than offered as arbitrary editable text. Literals expose their values; Lambda and LetRec expose binder names and declaration selectors.

The palette’s type selector offers Int, Bool and Int -> Int. Existing declaration selectors offer further simple arrow choices. Use Source Code for nested arrow annotations such as (Int -> Int) -> Int .

A refused update leaves the previous graph and history in place. Fix the connected values or the declaration rather than trying to change the visual socket shape.

Type compatibility is not the whole check

Two ports can both be Int and still form an illegal connection: a Lambda-local value cannot escape into an outside computation, and a binder must be used in its lexical scope. Direction, one producer per input and cycle restrictions also apply.

Read the full diagnostic, including the code. Type holes are allowed during editing, so an expected type next to an empty socket is guidance for the next connection. It does not make the graph executable yet.

GraphLambda is developed at L-Workshop .