derw
Version:
An Elm-inspired language that transpiles to TypeScript
22 lines (21 loc) • 579 B
TypeScript
export { Maybe };
export { Just };
export { Nothing };
export { map };
export { withDefault };
export { andThen };
type Just<a> = {
kind: "Just";
value: a;
};
declare function Just<a>(args: {
value: a;
}): Just<a>;
type Nothing = {
kind: "Nothing";
};
declare function Nothing(args: {}): Nothing;
type Maybe<a> = Just<a> | Nothing;
declare function map<a, b>(fn: (arg0: a) => b, maybe: Maybe<a>): Maybe<b>;
declare function withDefault<a>(defaultValue: a, maybe: Maybe<a>): a;
declare function andThen<a, b>(fn: (arg0: a) => Maybe<b>, maybe: Maybe<a>): Maybe<b>;