curry.inspect module

Inspect live Curry objects.

curry.inspect.cons_head(arg)[source]
curry.inspect.cons_tail(arg)[source]
curry.inspect.fwd_chain_target(arg)[source]
curry.inspect.fwd_target(arg)[source]
curry.inspect.get_choice_alternatives(arg)[source]
curry.inspect.get_choice_id(arg)[source]
curry.inspect.get_freevar_id(arg)[source]
curry.inspect.get_left_alternative(arg)[source]
curry.inspect.get_right_alternative(arg)[source]
curry.inspect.get_set_id(arg)[source]
curry.inspect.get_setguard_value(arg)[source]
curry.inspect.geticurry(obj)[source]

Gets the ICurry of a module, a type, or a symbol.

A module loaded from its compiled code carries a bill of materials: an IModule whose functions have no body (IModule.fromBOM). For such a module, and for a function of it, the ICurry is read from the ICurry-JSON file beside the module, and the function is found there by name. The file is read once per module object. A module without the file gives the bill of materials.

curry.inspect.geticurryfile(moduleobj)[source]

Gets the ICurry file associated with a module.

curry.inspect.getimpl(obj)[source]

Gets the implementation of a module or symbol as text.

For a module, the code the backend generates for it (see curry.save). For a function symbol, the code of its step function. The Python backend gives the generated Python function, or the Python source of a built-in. The C++ backend gives the generated C++ function, read from the .cpp file beside the compiled module, or the bytecode of an interpreted function (flag interpret) with its constants.

Raises:

ValueError – No code is available: a constructor, a built-in of the C++ runtime, or a function the backend made without a step.

curry.inspect.getjsonfile(moduleobj)[source]

Returns the file containing ICurry-JSON, if one exists, or None.

curry.inspect.getsymbol(moduleobj, symbolname)[source]

Looks up a symbol relative to a module.

The name may contain dots. For example, looking up 'List.nub' relative to the Data module returns Data.List.nub.

Parameters:
  • moduleobj – An instance of CurryModule.

  • symbolname – The symbol name.

Returns:

A Curry symbol.

curry.inspect.gettype(moduleobj, typename)[source]

Looks up a type relative to a module.

The name may contain dots. For example, looking up 'SetFunctions.Values' relative to the Control module returns Control.SetFunctions.Values.

Parameters:
  • moduleobj – An instance of CurryModule.

  • typename – The type name.

Returns:

A Curry type.

curry.inspect.info_of(arg)[source]
curry.inspect.is_boxed(node)[source]
curry.inspect.is_data(arg)[source]
curry.inspect.isa(arg, what)[source]

Checks whether the given Curry object is an instance of the given type or constructor. The second argument may be a sequence to check against.

curry.inspect.isa_bool(arg)[source]
curry.inspect.isa_boxed_char(arg)[source]
curry.inspect.isa_boxed_float(arg)[source]
curry.inspect.isa_boxed_int(arg)[source]
curry.inspect.isa_boxed_primitive(arg)[source]
curry.inspect.isa_char(arg)[source]
curry.inspect.isa_choice(arg)[source]
curry.inspect.isa_cons(arg)[source]
curry.inspect.isa_constraint(arg)[source]
curry.inspect.isa_ctor(arg)[source]
curry.inspect.isa_curry_expr(arg)[source]
curry.inspect.isa_curry_expr_or_none(arg)[source]
curry.inspect.isa_failure(arg)[source]
curry.inspect.isa_false(arg)[source]
curry.inspect.isa_float(arg)[source]
curry.inspect.isa_freevar(arg)[source]
curry.inspect.isa_func(arg)[source]
curry.inspect.isa_fwd(arg)[source]
curry.inspect.isa_int(arg)[source]
curry.inspect.isa_io(arg)[source]
curry.inspect.isa_list(arg)[source]
curry.inspect.isa_nil(arg)[source]
curry.inspect.isa_operator_name(name)[source]
curry.inspect.isa_primitive(arg)[source]
curry.inspect.isa_setguard(arg)[source]
curry.inspect.isa_true(arg)[source]
curry.inspect.isa_tuple(arg)[source]
curry.inspect.isa_tuple_name(name)[source]
curry.inspect.isa_unboxed_char(arg)[source]
curry.inspect.isa_unboxed_float(arg)[source]
curry.inspect.isa_unboxed_int(arg)[source]
curry.inspect.isa_unboxed_primitive(arg)[source]
curry.inspect.symbols(moduleobj, private=False)[source]

Gets the name of each function and constructor symbol defined in a module.

Parameters:
  • moduleobj – An instance of CurryModule.

  • private – Whether to include private symbols.

Returns:

A dict.

curry.inspect.tag_of(arg)[source]
curry.inspect.types(moduleobj)[source]

Gets the name of each type defined in a module.

Parameters:

moduleobj – An instance of CurryModule.

Returns:

A dict.

curry.inspect.unboxed_value(arg)[source]