https://github.com/hyper63/free
https://github.com/hyper63/free
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/hyper63/free
- Owner: hyper63
- Created: 2021-01-17T02:14:43.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-20T00:47:45.000Z (about 5 years ago)
- Last Synced: 2025-01-13T05:41:40.708Z (about 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
free
Free is a functional type designed to wrap other types and enable interfaces to plugin or apply interpreters to a functional
application pipeline. This enables the adapter pattern for functional applications where the side effects can be injected into
the program flow using `foldMap`.
---
## Table of Contents
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Features](#features)
- [Methods](#methods)
- [Contributing](#contributing)
- [License](#license)
## Getting Started
```js
import { Task } from 'https://x.nest.land/task@1.0.0/mod.js'
import { liftF } from 'https://x.nest.land/free@1.0.3/mod.js'
liftF(Task.of(() => Promise.resolve(':tada:')))
.fold(
e => assertEquals(true, false),
task => task.fork(
e => assertEquals(true, false),
r => assertEquals(r, ':tada:')
)
)
```
## Installation
This is a Deno module available to import from
https://nest.land/package/free
deps.js
```
export { liftF } from 'https://x.nest.land/free@1.0.3/mod.js'
```
## Features
* liftF
## Methods
* fold - folds over value and returns value to first and second function handlers
* foldMap - maps over values with and interpreter function then folds them into a single type
## Contributing
Pull Requests are welcome
## License
MIT
## Acknowledgements
The core code for this library was initiated from code shared by Brian Lonsdorf in a course from frontend masters. If you want to learn more about functional programming in javascript check it out: https://frontendmasters.com/courses/hardcore-js-v2/