hanki

manifest

stdlib/manifest.hk: read a built shared module's .hanki_manifest ELF section as reflected values: the data behind hanki inspect, exposed so a Hanki tool can render it (the inspect port) without re-implementing the ELF-section extract + wire-format decode. This is effectful artifact reflection (it reads a file), kept out of the pure compiler.* source- reflection namespace; read! is the one [fs_read] primitive, the types below mirror the hanki-manifest wire format one-to-one.

Reflection runs on the bytecode tier: open manifest match manifest.read!("libfoo.so") Ok(info) -> ... Err(e) -> ... end

MType

type MType
  UnitType
  Named(string)
  App(string, List<MType>)
  FnType(List<MType>, MType, List<string>)
  Param(int)
end

A wire-format type (hanki_manifest::Type): the slim shape the load-time compatibility check needs, decoupled from the compiler's own Ty.

TypeSig

struct TypeSig
  params: List<MType>
  return_type: MType
  effects: List<string>
end

A callable surface: parameter types, return type, and sorted effect names.

StructField

struct StructField
  name: string
  ty: MType
end

SumVariant

struct SumVariant
  name: string
  payload: List<MType>
end

TraitMethod

struct TraitMethod
  name: string
  is_action: bool
  is_prop: bool
  sig: TypeSig
end

ActorHandler

struct ActorHandler
  name: string
  sig: TypeSig
end

ExportKind

type ExportKind
  FnKind
  ActionKind
  StructKind
  SumKind
  TraitKind
  ImplKind
  ActorKind
end

What kind of item an export is.

ExportExtras

type ExportExtras
  FnExtras
  ActionExtras
  StructExtras(List<string>, List<StructField>)
  SumExtras(List<string>, List<SumVariant>)
  TraitExtras(List<string>, List<TraitMethod>)
  ImplExtras(string, List<MType>)
  ActorExtras(List<string>, List<StructField>, List<ActorHandler>)
end

Kind-specific payload beyond the TypeSig. Empty for plain fns/actions.

Export

struct Export
  kind: ExportKind
  original_name: string
  mangled_name: string
  type_signature: TypeSig
  extras: ExportExtras
end

One exported item from the module's manifest.

ManifestInfo

struct ManifestInfo
  magic: string
  manifest_version: int
  abi_revision: int
  compiler_version: string
  exports: List<Export>
  rifts: List<string>
end

A decoded .hanki_manifest section. rifts names the effects the module answers with native Rust of its own, empty for a module that binds none (and for one built before the manifest carried the field).

ManifestError

struct ManifestError
  message: string
end

Why reading a manifest failed (file missing, no .hanki_manifest section, or a malformed wire format); message is the human-readable detail.

read!

def read!(path: string) -> Result<ManifestInfo, ManifestError> [fs_read]

Read and decode the .hanki_manifest section of the shared module at path. Err where the file is unreadable, has no manifest section, or the section does not decode. @no-doctest: reads a built .so artifact and has no inline EXPR => VALUE example; covered by the manifest_reflect integration test