Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Created April 21, 2023 15:38
Show Gist options
  • Save cowboyd/72940846863223b86c3d6f1527dc14f6 to your computer and use it in GitHub Desktop.
Save cowboyd/72940846863223b86c3d6f1527dc14f6 to your computer and use it in GitHub Desktop.
Lift a simple function into an Effection operation
export function fn<TArgs extends unknown[],TReturn>(fn: (...args: TArgs) => TReturn): (...args: TArgs) => Operation<TReturn> {
return function* (...args: TArgs) {
return fn(...args);
}
}
// => map(fn(data => data.type))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment