Skip to content

Instantly share code, notes, and snippets.

@thoradam
thoradam / main.dart
Last active February 7, 2023 20:18
fluttering-diamond-1276
Future<int> onErrorTrickery() {
var f = Future<int>.error("original error");
f.onError ((Object e, StackTrace st) {
print("onError callback running");
throw "you cannot catch this error";
});
return f;
}
Future<void> secretError( ) async {
@thoradam
thoradam / io.ts
Created March 5, 2020 15:02
Pure TypeScript
// Did you know JavaScript has pure functions*?
// *: just add asterisks!
/**
* Describes a computation that requires `E` to produce an `A`. Has to be run
* to do anything.
*
* We could also do something like:
* `type Async<E,A> = Generator<void,Promise<A>,E>`
*/
@thoradam
thoradam / Main.purs
Created September 28, 2017 00:15
Prepack on PureScript
module Main where
import Prelude
import Control.Monad.Eff.Console (log)
import Run (FProxy, Run, SProxy(SProxy), interpret, liftEffect, runBase)
data Speak a = Talk String a | Shout String a
derive instance functorSpeak :: Functor Speak
### Keybase proof
I hereby claim:
* I am thoradam on github.
* I am thoradam (https://keybase.io/thoradam) on keybase.
* I have a public key whose fingerprint is EE55 B641 5693 7E88 EF24 65CA D294 D103 3923 9708
To claim this, I am signing this object: