The Main Function
The entry point of any Flix program is the
main function which must have the
def main(): Unit \ IO
That is, the
- must return
- must be marked as effectful (i.e. have the effect annotation
The signature of
main does not specify any arguments, but the command line
arguments passed to the program can be accessed by calling
def main(): Unit \ IO = let args = Environment.getArgs(); ...
main to have the
IO effect. If main was pure there would be no
reason to run the program. Typically the effectful requirement is satisfied
main prints to the console or has another side-effect.