Module riak_pipe_v

Helpers for validating inputs.

Description

Helpers for validating inputs.

Function Index

type_of/1Determine the type of a term.
validate_function/3Validate that Fun is a function of arity Arity.
validate_module/2Validate that Module is an atom that names a loaded or loadable module.

Function Details

type_of/1

type_of(Term::term()) -> pid | reference | list | tuple | atom | number | binary | function

Determine the type of a term. For example:

  number = riak_pipe_v:type_of(1).
  atom = riak_pipe_v:type_of(a).
  pid = riak_pipe_v:type_of(self()).
  function = riak_pipe_v:type_of(fun() -> ok end).

validate_function/3

validate_function(Label::string(), Arity::integer(), Fun::function() | {atom(), atom()}) -> ok | {error, iolist()}

Validate that Fun is a function of arity Arity.

If the function is of type local (anonymous functions, and functions named via fun Name/Arity), validation completes onces the arity is checked.

If the function is of type external (functions named via fun Module:Function/Arity), then it is also verified that the module is loaded or loadable (see validate_module/2) and that it exports the named function.

If validation completes successfully, the atom ok is returned. If validation failes, an {error, Reason} tuple is returned. (Label is used in the error message).

validate_module/2

validate_module(Label::string(), Module::term()) -> ok | {error, iolist()}

Validate that Module is an atom that names a loaded or loadable module. If a module is already loaded under that name, or code:load_file/1 is able to load one, the atom ok is returned. If no module is found, and {error, Reason} tuple is returned. (Label is used in the error message).


Generated by EDoc, Aug 5 2012, 06:59:40.