How to use the monet.Either.Right function in monet

To help you get started, we’ve selected a few monet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github char0n / monad-t / tonicExample.js View on Github external
require('fantasy-land');
const { Future } = require('fluture');
const { Identity, Either } = require('monet');

const { MonetEitherT: EitherT } = require('monad-t');
const { FlutureTMonetEither: FutureTEither } = require('monad-t');


EitherT(Identity.of(1)); // => Either.Right(1)

FutureTEither.of(Future.of(Either.Right(1))); // => FlutureTMonetEither(1)
github char0n / monad-t / test / FlutureTMonetEither / index.js View on Github external
it('tests not mapping the right', function(done) {
      FlutureTMonetEither
        .fromEither(Either.Right(1))
        .leftMap(val => val + 1)
        .fork(
          noop,
          (val) => {
            assert.strictEqual(val, 1);
            done();
          }
        );
    });
  });
github char0n / monad-t / test / FlutureTMonetEither / index.js View on Github external
it('tests lifting Either into FlutureTMonetEither', function() {
    const a = Either.Right(1);
    const b = liftEither(a);

    assert.isTrue(isFlutureTMonetEither(b));
  });
});
github char0n / monad-t / test / FlutureTMonetEither / index.js View on Github external
it('tests Either.Left in both FTEs', function(done) {
      FlutureTMonetEither
        .fromFuture(Future.of('val'))
        .filter(always(false), 'error1')
        .and(FlutureTMonetEither
          .fromEither(Either.Right('val'))
          .filter(always(false), 'error2')
        )
        .fork(
          (val) => {
            assert.strictEqual(val, 'error1');
            done();
          },
          noop
        );
    });
  });
github char0n / monad-t / test / FlutureTMonetEither / index.js View on Github external
    const add1 = a => FlutureTMonetEither.of(Future.of(Either.Right(a + 1)));
    const fe = FlutureTMonetEither.of(Future.of(Either.Right(1))).chain(add1);
github stationfive / refuncjs / src / services / http.js View on Github external
.flatMap(async (data: Object): Either => {
          const body: JSON = await data.json();
          return data.status >= 400 ? Either.Left(body.message) : Either.Right(body);
        })).catch(Either.left);
  }
github stationfive / refuncjs / src / services / http.js View on Github external
      .then((resp: Response): Either => Either.Right(resp)
        .flatMap(async (data: Object): Either => {
          const body: JSON = await data.json();
          return data.status >= 400 ? Either.Left(body.message) : Either.Right(body);
        })).catch(Either.left);
  }
github aappddeevv / dynamics-client-ui / packages / dynamics-client-ui / src / Data / interfaces.ts View on Github external
    ok: (c: Content): Result => Either.Right(c),
    error: (e: ErrorInfo): Result => Either.Left(e),
github char0n / monad-t / src / FlutureTMonetEither / index.js View on Github external
FlutureTMonetEither.fromValue = function fromValue(val) {
  return this[of](Future.of(Either.Right(val)));
};