corecursive-main: Write your main like it can call itself back.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Please see the README on GitHub at https://github.com/githubuser/corecursive-main#readme


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.0
Change logChangeLog.md
Dependenciesbase (>=4.7 && <5), corecursive-main, process, unix [details]
LicenseBSD-3-Clause
Copyright2018 Author name here
AuthorAuthor name here
Maintainerexample@example.com
CategoryControl
Home pagehttps://github.com/githubuser/corecursive-main#readme
Bug trackerhttps://github.com/githubuser/corecursive-main/issues
Source repositoryhead: git clone https://github.com/githubuser/corecursive-main
Executablescorecursive-main-exe
UploadedSun Aug 19 13:57:24 UTC 2018 by LucasDiCioccio

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for corecursive-main-0.1.0.0

[back to package description]

corecursive-main

Functional programmers are used to program with (co-)recursive functions. What if the main program was itself recursive? One could benefit the underlying operating system scheduler to orchestrate resources. For instance, limiting memory, file-descriptor on a per-recursive-call basis. Another instance is supporting distributed computations across multiple machines.

This package

This package demonstrates the idea of replacing the main entry-point of the program (i.e., main :: IO ()) with a recursion-aware main. The program first pattern matches on an "argument". This argument defines which action to take for the rest of the program. The rest of the program runs with a "Self-reference", which allows the program to call itself back. Explicitly passing a Self-reference is very similar to how the fix function allows to factor recursion out of the body of a self-referential function.

Unlike fix, which executes recursive-call in the same memory-space as the call-site, developper using this package need to teach the program to transfer arguments and return values back-and-forth the call-site and the execution site. This package minimizes the developper effort to perform this translation.

Currently, one mode is supported: spawning a child process on the same OS while serializing arguments over the command-line parameters.

Future versions of this package or sibling packages will likely provide:

Envisionned usages

Distributed computating:

Dev/Ops:

History

This package is factored out of code and findings made while writing DepTrack. If you like this package you may find other interesting ideas in DepTrack.