# do-syntax

> Haskell like do-syntax for JavaScript

Latest version **0.1.2** (published 2013-08-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install do-syntax
pnpm add do-syntax
yarn add do-syntax
bun add do-syntax
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2013-08-08 |
| First published | 2013-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | alucky0707 |
| Maintainers | alucky0707 |
| Keywords | monad, functional |

## Links

- npm: https://www.npmjs.com/package/do-syntax
- Repository: git@github.com:alucky0707/do-syntax
- npm.io page: https://npm.io/package/do-syntax

## Recent versions

- 0.1.2 (latest) — 2013-08-08
- 0.1.1 — 2013-07-15
- 0.1.0 — 2013-07-15

## README

Haskell like do-syntax for JavaScript

##Example

###List monad

```javascript
var
doSyntax = require('do-syntax'),

xs = [1,2],
ys = eval(doSyntax.syntax)(doSyntax.listM, function () {
    x1 <- xs;
    x2 <- xs;
    return pure([x1, x2]);
});

console.log(ys); // [[1,1],[1,2],[2,1],[2,2]]
```

###Async Monad

```javascript
var
fs = require('fs'),
doSyntax = require('do-syntax');

eval(doSyntax.syntax)(doSyntax.asynxM, function () {
    file1 <- async(fs.readFile)('file1.txt', 'UTF-8');
    file2 <- async(fs.readFile)('file2.txt', 'UTF-8');
    console.log(file1 + file2);
    return pure();
})(function (err) {
    //error callback
    console.log(err);
});
```

---
_Source: https://npm.io/package/do-syntax · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
