Skip to content

Instantly share code, notes, and snippets.

@shovon
Created March 28, 2022 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shovon/4c60ebb3443c23861b2ee64540d6b83d to your computer and use it in GitHub Desktop.
Save shovon/4c60ebb3443c23861b2ee64540d6b83d to your computer and use it in GitHub Desktop.
type Pipe<T> = {
_<V>(fn: (value: T) => V): Pipe<V>;
readonly value: T;
};
function start<T>(initial: T): Pipe<T> {
return {
_<V>(fn: (value: T) => V): Pipe<V> {
return start(fn(initial));
},
get value() {
return initial;
},
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment