An open API service indexing awesome lists of open source software.

https://github.com/hyper63/free


https://github.com/hyper63/free

Last synced: about 1 year ago
JSON representation

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`.



Current Version


---

## 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/