kbilsted / functional-core-imperative-shell Goto Github PK
View Code? Open in Web Editor NEWFunctional core imperative shell
License: Apache License 2.0
Functional core imperative shell
License: Apache License 2.0
Article: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
Argues that functions should not be different between sync and async. But in terms of pure/effectful, maybe it's a good thing that functions cannot be mixed however which way? The "color" of a function might be used to enforce a functional core.
Sometimes you have one shell, sometimes you have more. How to avoid duplicating organizing code when you have many shells? Or is that duplication a good thing, if logic can later diverge?
There's a lot of focus around doing this on the front end. And it's true using UIs are doused in reactivity and asynchrony. Also, React was the iPod moment for functional programming along with Flux/Redux. Anyways, there is plenty of application for this pattern in a sufficiently effectual backend. And for backends that don't even have a lot of effects, lifting them to the top would go a long way to improve the test cases by omitting the mocks.
Instead of writing to the database or file, create an event or closure to deal with it later.
Hi ho!
I started to think about this pattern again, but this time in more OOP terms, with regard to state, dependencies and pure vs effectful classes. I think it should be possible to distinguish between "functional core" classes and "imperative shell" dito.
Discussion on Reddit here: https://old.reddit.com/r/PHP/comments/n484hv/discussion_a_class_should_have_state_or/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.