Modules
You can put declarations in module files to organise your code.
Scripts (and modules) can import modules with the import
declaration.
Like this:
let import My.Stuff; in outputLn sometext
Module names are one or more unames, separated by periods.
To import the module My.Stuff
, Pinafore will look for a file in these paths in this order:
$dir/My/Stuff.pinafore
for each-I $dir
on the command line$pinafore/lib/My/Stuff.pinafore
, where$pinafore
is the local pinafore directory (typically$HOME/.local/share/pinafore
)/usr/local/share/pinafore/lib/My/Stuff.pinafore
/usr/share/pinafore/lib/My/Stuff.pinafore
A module file looks something like this (see syntax):
let sometext :: Text; sometext = "Hello"; somenumber :: Integer; somenumber = 4; opentype X; closedtype T = T1 Integer Boolean | T2; subtype T <: X; in export sometext somenumber X T T1 T2
The export
statement exports the given names (values, types, type constructors) that will be available when imported.
Subtype relations are always exported.