Skip to content

Instantly share code, notes, and snippets.

@iagobelo
Created November 11, 2024 13:27
Show Gist options
  • Save iagobelo/42983942eedd2a791be446675b35642b to your computer and use it in GitHub Desktop.
Save iagobelo/42983942eedd2a791be446675b35642b to your computer and use it in GitHub Desktop.
dokey
type DonkeyBasket<V> = {
value: V;
};
// map
// toValue
// fromPredicate?
// filter
// attach
interface DonkeyMap<A> {
map: <B>(a: A) => B;
}
interface Donkey<A> extends DonkeyMap<A> {
(value: A): string;
}
const donkey = <A>(value: A) => {
return {
map: <B>(a: A) => {
if (typeof a === "number") {
return a.toString();
}
return a;
},
toValue: () => value,
};
};
// donkey(value).map(x => y).filter(x => x).attach('xablau', y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment