Created
March 12, 2019 06:43
-
-
Save puffnfresh/fb08b02915a6018a10335ed884e8819f 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