How to use the fp-ts/lib/function.constant function in fp-ts

To help you get started, we’ve selected a few fp-ts 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 mikearnaldi / matechs-effect / packages / effect / src / stream / index.ts View on Github external
() =>
                          pipe(
                            T.race(breakerError, waitFiberSlot(fiberSlot)),
                            T.foldExit(
                              c => pushBreaker.cause(c), // if we get a latchError forward it through to downstream
                              constant(pushQueue.offer(none)) // otherwise we are done, so lets forward that
                            )
                          ),
                        next =>
github musicglue / pg-ts / src / query.ts View on Github external
const decodedQueryResultTE = queryResultTE.chain(result =>
      fromEither(
        fromPredicate(isNonEmptyResult, constant(expectedAtLeastOneErrorFailure(query, context)))(
          result,
        )
          .map(({ rows }) => transformer(rows))
          .mapLeft(identity)
          .chain(rows =>
            t
              .array(type)
              .decode(rows)
              .mapLeft(makeRowValidationError(type, rows, context)),
          )
          .map(rows => new NonEmptyArray(rows[0], rows.slice(1))),
      ),
    );
github gcanti / monocle-ts / src / index.ts View on Github external
    return s => this.modify(constant(a))(s)
  }
github mikearnaldi / matechs-effect / packages / effect / src / stream / index.ts View on Github external
export function as(stream: Stream, b: B): Stream {
  return map_(stream, constant(b));
}
github mikearnaldi / matechs-effect / packages / effect / src / stream / index.ts View on Github external
export function concat(
  stream1: Stream,
  stream2: Stream
): Stream {
  return concatL(stream1, constant(stream2));
}
github rzeigler / waveguide / src / managedr.ts View on Github external
export function as(fa: ManagedR, b: B): ManagedR {
  return map(fa, constant(b));
}
github musicglue / pg-ts / src / transaction.ts View on Github external
() =>
      connection
        .query(SQL`COMMIT;`, context)
        .run()
        .then(eitherToPromise)
        .then(constant(a)),
    e => (isDriverQueryError(e) ? e : makeUnhandledConnectionError(e)),
github SamHH / bukubrow-webext / src / store / bookmarks / reducers.ts View on Github external
case BookmarksActionTypes.SetBookmarkDeleteId:
			return bookmarkDeleteId.set(a.payload);

		case BookmarksActionTypes.SetStagedBookmarksGroupEditId:
			return stagedBookmarksGroupEditId.set(a.payload);

		case BookmarksActionTypes.SetStagedBookmarksGroupBookmarkEditId:
			return stagedBookmarksGroupBookmarkEditId.set(a.payload);

		case BookmarksActionTypes.UpdateStagedBookmarksGroupBookmark: {
			const [newGrpId, newBm] = a.payload;
			const eqGrp = flow(grpId.get, eqNumber(newGrpId));
			const eqBm = flow(bmId.get, eqNumber(newBm.id));

			return stagedBookmarksGroups.modify(mapByPredicate(
				grpBms.modify(mapByPredicate(constant(newBm))(eqBm))
			)(eqGrp));
		}

		case BookmarksActionTypes.DeleteStagedBookmarksGroupBookmark: {
			const [newGrpId, newBmId] = a.payload;
			const eqGrp = flow(grpId.get, eqNumber(newGrpId));
			const eqBm = flow(bmId.get, eqNumber(newBmId));

			return stagedBookmarksGroups.modify(mapByPredicate(
				grpBms.modify(A.filter(not(eqBm))),
			)(eqGrp));
		}

		case BookmarksActionTypes.SetDeleteBookmarkModalDisplay:
			return displayDeleteBookmarkModal.set(a.payload);
github SamHH / bukubrow-webext / src / store / epics.ts View on Github external
const onLoadPreComms = (): ThunkAC => (dispatch) => {
	getActiveTheme()
		.then(EO.getOrElse(constant(Theme.Light)))
		.then((theme) => {
			dispatch(setActiveTheme(theme));
		});
};