Saturday, July 17, 2010

[rekqbqdm] Auto main

Given a program, scan through all the functions and generate a "main" so that every reasonable function may be invoked from the command line by name, passing command line arguments.

All arguments must be String or be a Read Instance, the output must be String or a Show instance, possibly wrapped in IO.

Or the output may be the exit value, then any numeric, Bool, Maybe, List, ErrorT, or anything that can be compared with equality to mzero (in MonadPlus) that can be mapped to a Success can work, though though the "sign convention" might be arbitrary.

Provide a "help" to list all possibilities.  Provide tab completion (requires the shell to have some API).

No comments :