loquat-qo

Allow friendly syntax for loquat using generators

Usage no npm install needed!

<script type="module">
  import loquatQo from 'https://cdn.skypack.dev/loquat-qo';
</script>

README

loquat-qo

Allow friendly syntax for loquat using generators , like do-notation in Haskell.

Before:

const parser = parserA.bind(x =>
    parserB.bind(y =>
        perserC.bind(z =>
            pure(something(x, y, z))
        )
    )
);

After:

const parser = qo(function* () {
    const x = yield parserA;
    const y = yield parserB;
    const z = yield parserC;
    return something(x, y, z);
});

See loquat repository for more information.

License

MIT License

Author

Susisu (GitHub, Twitter)