Skip to content

Instantly share code, notes, and snippets.

View ewilliams-zoot's full-sized avatar

Ezekiel Williams ewilliams-zoot

View GitHub Profile
@ewilliams-zoot
ewilliams-zoot / compose.js
Last active December 2, 2021 05:45
Functional Programming Notes
const compose = (...fns) => (...args) => fns.reduceRight((acc, fn) => [fn(...acc)], args)[0];
// sub :: (a, b) -> a
const sub = curry((a, b) => b - a);
const mathPipeline = compose(increment, sub(2), add(4));
mathPipeline(10);// 13
@ewilliams-zoot
ewilliams-zoot / controller.dart
Created August 21, 2021 22:22 — forked from ricbermo/controller.dart
Repository-Provider-Controller Patter
// custom provider to improve lists performance
final currentModel = ScopedProvider<Category>(
(_) => throw UnimplementedError(),
);
// used to display snackbars
final exceptionProvider = StateProvider<CustomException>(
(_) => null,
);