type-of inspects the inferred type of a Coalton expression.
Syntax
(type-of ⟨expr⟩)
Semantics
type-ofis used inside a Coalton expression, often at the REPL throughcoalton.- It returns a representation of the inferred type scheme for
⟨expr⟩. One may useshowto see a printed representation. - This is useful when type inference succeeds but the exact inferred type is not obvious.
- For alias-oriented REPL output, see
describe-type-of.
Example
(coalton-toplevel
(define (fun x)
(map (fn (y) (+ 2 y)) (str:parse-int x))))
(coalton (type-of fun))