Created
March 28, 2022 03:50
-
-
Save shovon/4c60ebb3443c23861b2ee64540d6b83d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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