How to use the fp-ts-contrib/lib/TaskOption.fromOption function in fp-ts-contrib

To help you get started, we’ve selected a few fp-ts-contrib 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 SamHH / bukubrow-webext / src / modules / context.ts View on Github external
);

		case ContextMenuEntry.SendActiveTab: return pipe(
			getActiveTab,
			T.map(flow(
				O.chain(tab => OT.fromNullable(tab.title, tab.url)),
				O.map(([title, url]) => [{ title, url }]),
				O.chain(NEA.fromArray),
			)),
		);

		case ContextMenuEntry.SendLink: return pipe(
			u,
			O.map(url => [{ url, title: url }]),
			O.chain(NEA.fromArray),
			TO.fromOption,
		);

		default: return TO.none;
	}
};
github SamHH / bukubrow-webext / src / modules / comms / isomorphic.ts View on Github external
export const listenForIsomorphicMessages = (f: (m: IsomorphicMessage) => void): IO =>
	createIsomorphicMessageListener(f)(flow(
		O.fromPredicate(isIsomorphicMessage),
		TO.fromOption,
	));