-
-
Save piq9117/720c7f854c3c8dfd8c51b3affd63bd2a to your computer and use it in GitHub Desktop.
This file contains 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 LoadedData<A> = | |
<B>(f: (a: A) => B, g: (e: Error) => B, b: B) => B; | |
function loaded<A>(a: A): LoadedData<A> { | |
return <B>(f: (a: A) => B, error: (e: Error) => B, empty: B) => f(a); | |
} | |
function error<A>(e: Error): LoadedData<A> { | |
return <B>(success: (a: A) => B, f: (e: Error) => B, empty: B) => f(e); | |
} | |
function loading<A>(): LoadedData<A> { | |
return <B>(success: (a: A) => B, error: (e: Error) => B, e:B ) => e; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment