https://github.com/mgree/trampoline
Safely running potentially non-terminating functions in Elm.
https://github.com/mgree/trampoline
Last synced: over 1 year ago
JSON representation
Safely running potentially non-terminating functions in Elm.
- Host: GitHub
- URL: https://github.com/mgree/trampoline
- Owner: mgree
- License: mit
- Created: 2018-11-30T21:33:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T19:42:14.000Z (over 5 years ago)
- Last Synced: 2025-03-21T19:12:51.971Z (over 1 year ago)
- Language: JavaScript
- Size: 470 KB
- Stars: 10
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/mgree/trampoline)
Fueled computations in Elm.
The `Fuel` monad allows one to structure computations that use up 'gas', which allows one to write potentially non-terminating code in a relatively direct style. It turns out that these gas-based computations form a monad, so we can define usual functions like `map` and `andThen`.
# Example
See https://mgree.github.io/trampoline for an example of how to use
the trampoline pattern, a way of structuring a program to use `Fuel`:
timers or other events trigger fueled computations; the source code in
this repository, at
[example/src](https://github.com/mgree/trampoline/tree/master/example/src).