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
class IO { | |
// We construct the IO type with a thunk/callback that returns the value when called | |
constructor( fn ){ | |
this.fn = fn; | |
} | |
// IO doesn't do anything until we explicitly call it. | |
run(){ | |
return this.fn(); |