These are chat archives for ramda/ramda

25th
Sep 2018
Konstantin
@outluch
Sep 25 2018 03:33
Hello guys! Anyone please help with ramda and pointfree style, that I am trying to grasp??
I want to write some simple app: i pass it url, checks simple db for that url saved (like cache), if there is cache, it returns html text, saved there, if no cache, it fetches html from web, saves html to cache db and returns html.
Pseudocode is:
readFromCache(url)
if exists return html
else  fetchFromWeb(url), writeToCache(url, html), return html
i am trying to write that with ramda pipe.
Konstantin
@outluch
Sep 25 2018 03:42
const app = R.pipe(
  either(
    readFromCache(getDbConnection()),
    R.pipe(
      fetchHtmlFromWeb,
      writeToCache(getConnection())
    )
  )
)
app('http://example.com')
Notice, I need url and html to save in writeToCache function, but i get only html from fetching function. How can I propagate url to writer, or what is my error here? I feel like I misunderstand something core