loading...

re: Function vs Object VIEW POST

TOP OF THREAD FULL DISCUSSION
re: OOP: mjölnir.smash() // mjölnir is an object FP: mjölnir.smash() // mjölnir is a namespace
 

In FP functions without arguments are code smell because most probable they contain side effects. So in FP it would be:
const mjölnirSmash = smash(mjölnir);
const newGround = mjölnirSmash(currentGround);

Or with ADT something like this:
const ground = Functor(/* some data */);
const newGround = ground.map(smash(mjölnir));

Code of Conduct Report abuse