ramda / ramda-fantasy

:ram::sparkles: Fantasy-Land compatible types for easy integration with Ramda.js
MIT License
1.5k stars 95 forks source link

Is it wrong to call "runIO()" twice? #176

Closed Djordjenp closed 2 years ago

Djordjenp commented 2 years ago

Hello, I am trying to take element from the DOM and set it's text content, but I end up calling "runIO()" twice, because my IO action returns another IO:

import {IO} from "ramda-fantasy";

const logger = data => IO(() => console.log(data));
const getElement = id => IO(() => document.querySelector(id))
const setElementText = element => text => IO( () =>element.textContent = text)

const someText = IO(() => 'New Title')

getElement('h1').map(setElementText).ap(someText).runIO().runIO();

I am aware that I can swap argument positions in "setElementText" function, but I am interested is there a solution for this kind of stuff. Maybe I can use ramda's chain function to unwrap this inner IO somehow?

CrossEye commented 2 years ago

Note that this project has long been deprecated. None of its developers are currently active. The Ramda team recommends switching to another implementation.

https://github.com/ramda/ramda-fantasy/blob/master/README.md#project-status

davidchambers commented 2 years ago

Shall we archive this project, @CrossEye?

CrossEye commented 2 years ago

@davidchambers: perhaps. I still use it occasionally, but always from the NPM repo.

I haven't dealt with archiving a project before, so I'm not sure what it would entail. For the moment, I'll pin an issue that explains what's also in the README.