describe-type-alias is a Common Lisp REPL helper that prints the underlying expansion of a Coalton type alias.
Syntax
(describe-type-alias ⟨symbol⟩)
Semantics
describe-type-aliasis an ordinary Common Lisp function (called outsidecoalton), and⟨symbol⟩must evaluate to acl:symbol.- It looks up
⟨symbol⟩in Coalton’s global type-alias environment:- If
⟨symbol⟩names a type alias defined withdefine-type-alias, it prints the alias and its expanded type (in:types-and-aliasesmode) to*standard-output*. - If
⟨symbol⟩is not a known type alias (even if it names a nominaldefine-typeordefine-struct), it printsunknown.
- If
- Returns zero values
(cl:values).
Examples
(coalton-toplevel
(define-type-alias (Pair :a) (Tuple :a :a))
(define-type-alias IntPair (Pair Integer)))
(describe-type-alias 'Pair)
;; prints: #<COALTON-IMPL/TYPECHECKER/TYPES:TAPP [PAIR :A := TUPLE :A :A]>
(describe-type-alias 'IntPair)
;; prints: #<COALTON-IMPL/TYPECHECKER/TYPES:TAPP [INTPAIR := PAIR INTEGER := TUPLE INTEGER INTEGER]>