curry.toolchain.flat2icurry.interfaces module

Finds and reads the FlatCurry interfaces of imported modules.

The Curry front end writes the interface M.fint of a module M beside its M.fcy. Two layouts occur. The front end puts the files of the hierarchical module A.B under <root>/.curry/<subdir>/A/B.fint, and Sprite keeps per-directory products under <root>/A/.curry/<subdir>/B.fint. The finder tries both. When no interface exists, the full .fcy serves, because the translation uses only names, visibilities, and data types.

class curry.toolchain.flat2icurry.interfaces.InterfaceFinder(searchdirs, subdirs, progs=())[source]

Bases: object

Looks up the interface of a module by name.

Parameters:
  • searchdirs – The directories to search, as a Curry path.

  • subdirs – The names of the subdirectories of .curry that hold the front end output, e.g., ['pakcs-3.4.1'].

  • progs – Programs already in hand, used before any file is read.

candidates(modname)[source]
filename(modname)[source]

The file that holds the interface of modname.

find(modname)[source]

The FlatCurry interface of modname.

curry.toolchain.flat2icurry.interfaces.load_interface(filename)[source]

Reads a FlatCurry file. Files are cached by name, size, and time.

curry.toolchain.flat2icurry.interfaces.module_root(fcyfile, modname)[source]

The directory from which the module modname was compiled, given its FlatCurry file. The file of module A.B lies at <root>/.curry/<subdir>/A/B.fcy or at <root>/A/.curry/<subdir>/B.fcy.

curry.toolchain.flat2icurry.interfaces.product_path(filename)[source]

Splits the path of a front-end product into (root, subdir, tail). The file lies at <root>/.curry/<subdir>/<tail>/M.ext; tail is empty for a module at the top level and A/B for a module under A.B. Returns None when no .curry directory encloses the file.