Skip to content
ViSML HelpVisual Standard ML v5.0.0
04 / Types

Type syntax, without a type checker

ViSML lets you write everything SML's type syntax allows — annotations, type variables, function types, the lot. What it will not do is tell you whether any of it is correct. That is not an oversight; it is the boundary the project draws around itself.

Writing real annotations

A dec_val or dec_fun block carries a small toggle, chkTyp, that opens or closes an extra socket for a Type-category block. Switch it on and you can write exactly what SML lets you write:

val x : int = 5
fun succ (n : int) : int = n + 1

The Type category itself is small and compositional: typ_var for a type variable like 'a, typ_constructor for an applied type constructor such as int list, typ_function for the arrow ->, typ_primtv for the built-in primitives, and dedicated list, tuple and record type blocks alongside them. Nest them the way you would nest the corresponding text, and the generator reproduces the annotation exactly — see Blocks for where each one sits in the toolbox.

Nothing about chkTyp is more than syntactic sugar. Toggling it on adds a socket to the block and, if filled, a printed annotation to the generated text; toggling it off removes both. No verification happens at any point in that process.

The Type bubble

Right-click a block and, where it appears, a Type context-menu item opens a small floating bubble — something like Type: exp | pat | con. Despite the name, this is not a semantic type in the sense of type theory. It lists which SML grammar nonterminals that block's output can satisfy, read directly off Blockly's connection check metadata. The research behind ViSML calls this Grammar Awareness: how much of the grammar's structure is explicitly observable in the notation, rather than left implicit.

This menu item is not on every block

The Type entry only appears on blocks whose output connection carries a non-empty check array — in practice that means it shows up reliably on some blocks and not at all on others. Treat it as a useful spot-check when it is there rather than a guaranteed feature of every block in the toolbox.

The more consistently present affordance is the hover tooltip covered in Blocks → Tooltips and terminal labels, which shows a full grammar production rather than a bare nonterminal name and appears on essentially every block type.

No checker, by design

There is no type checker

ViSML performs no type inference and no type checking. There are no type errors to report, because nothing checks whether a program is well-typed — the chkTyp annotation and the Type bubble above are both syntactic: one prints a declared type, the other reports a grammatical category. Neither infers, unifies, or verifies anything.

This is a deliberate scope boundary, not a missing feature. ViSML's subject is the correspondence between blocks and grammar, not program correctness — that is a different, harder project, and one B-Lambda takes on instead, with full Hindley-Milner inference and a typing derivation view. If you want to know whether a ViSML program actually type-checks, the honest answer is to paste the generated SML into a real implementation and ask it — see Code Generation for exactly that workflow.

ViSML is developed at L-Workshop. This help was written against ViSML 5.0.0.