Skip to content

In this documentation ​

This documentation is most interactive when viewed within Emacs, where it is possible to directly evaluate and tweak the provided examples.

The M-x et-last-sexp command can be used to type-check the expression before the point. Note that this command runs in the current Emacs process (useful for self-contained experiments, such as those in this doc). However, if you are type-checking a buffer using flymake, then use et-peek to check the expression in the flymake process.

Some common utilities ​

Within a type-checked expression, the (:type TYPE) form is often used as a stub representing an arbitrary type. For example, the following tests how + behaves for various input types.

emacs-lisp
(+ (:type Integer) (:type Number))
;; >> Number
(+ (:type Integer) (:type String))
;; >> "+" errored: expected NumOrMarker, found String

The et macro is used to parse a type name:

emacs-lisp
(et Integer?)
;; -> Integer | Nil

The et-is? macro is used to check an expression against a particular type:

emacs-lisp
(et-is? 4 Integer)
;; -> t

As shown, >> indicates the result of type-checking an expression, while -> indicates the result of evaluating an expression at runtime.