Last active
December 18, 2019 08:25
-
-
Save ENvironmentSet/9485dd688971706c4f0fe89cefb8d21d to your computer and use it in GitHub Desktop.
Type safe any in Typescript
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 Any = <B>(f: <A>(a: A) => B) => B; // Instead of forall a. a, use it's continuation. (they're isomorphic) | |
function any<A>(a: A): Any { | |
return f => f(a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment