Combining Ramda and Folktale functors
_fetchLists is a function that performs an async operation, it takes the following arguments:
fetchAlllists: an async function that resolves with Result functor of an array of list objectslistIds: an array of listIdsit
returnsa Result functor of an array of list objects
const _fetchLists = R.curry(
  async(fetchAllLists, listIds) => {
    const lists = await fetchAllLists();
    return R.map(
      R.compose(
        R.values,
        R.pick(listIds),
        R.indexBy(R.prop('id'))
      ),
      lists
    );
  }
);