I'm learning Ramda and try to reach pointfree programming. In order to do that, I try to refactor here and there but got stuck on this.
I obviously think this doesn't work because the call is asychronous but I could not find what is wrong with this code.
// Why is this
const toJSONRamda = R.pipe(
R.prop('json'), // getting the 'json' function
R.call // and calling it
)
// different from this
const toJSON = response => response.json()
// Works
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(toJSON)
.then(console.log)
// Does not Work
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(toJSONRamda)
.then(console.log)
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js"></script>