TYPICAL / Guided Tour / Type
Bottom 

Type definition

Enumeration of constructors

:- type color   --> red; green; blue.
:- type machine --> fastm(int, string); slowm(int, string).
:- type nats0   --> 0; s(nats0).

Parametric polymorphism

:- type list(T)    --> []; [T|list(T)].
:- type bintree(T) --> leaf(T); bnode(T, bintree(T), bintree(T)).
:- type tree(T)    --> node(T, list(tree(T))).

Set abstraction via a Prolog goal

:- type posint --> {X | integer(X), X > 0}.

Type alias

:- type char_code == int.
:- type string == list(char_code).

Subtypes

:- suptype tree(T) > bintree(T).

:- subtype zero < nat.
:- subtype nat < int.

:- suptype nat > posint.
:- type int > negint.

Top 
PREV: TYPICAL libraries
NEXT: Predicate declaration

TYPICAL / Guided Tour / Type