module typing

module lib/typing.mu

import "typing"

typing provides utilities for type checking.

Functions

is#

fn is(value, type_name)

is returns true if the given value is of the given type.

Source lib/typing.mu:17
fn is(value, type_name) {
  return type_name == type(value)
}

is_bool#

fn is_bool(value)

is_bool returns true if the given value is a boolean.

Source lib/typing.mu:38
fn is_bool(value) {
  return is(value, _bool_type)
}

is_buf#

fn is_buf(value)

is_buf returns true if the given value is a buffer.

Source lib/typing.mu:58
fn is_buf(value) {
  return is(value, _buf_type)
}

is_function#

fn is_function(value)

is_function returns true if the given value is a function.

Source lib/typing.mu:63
fn is_function(value) {
  return is(value, _builtin_type) || is(value, _closure_type) || is(value, _function_type)    
}

is_int#

fn is_int(value)

is_int returns true if the given value is an integer.

Source lib/typing.mu:43
fn is_int(value) {
  return is(value, _int_type)
}

is_list#

fn is_list(value)

is_list returns true if the given value is a list.

Source lib/typing.mu:48
fn is_list(value) {
  return is(value, _list_type)
}

is_map#

fn is_map(value)

is_map returns true if the given value is a map.

Source lib/typing.mu:53
fn is_map(value) {
  return is(value, _map_type)
}

is_nil#

fn is_nil(value)

is_nil returns true if the given value is nil.

Source lib/typing.mu:33
fn is_nil(value) {
  return is(value, _nil_type)
}

is_str#

fn is_str(value)

is_str returns true if the given value is a string.

Source lib/typing.mu:28
fn is_str(value) {
  return is(value, _str_type)
}

Internal helpers

Underscore-prefixed names are implementation detail. They are listed so the module's source reads without surprises, not as API — they may change at any time.

_bool_type
_buf_type
_builtin_type
_closure_type
_function_type
_int_type
_list_type
_map_type
_nil_type
_str_type