code: function collectUnique(processes) {
    return processes.reduce(doCollect, []);
  
    function doCollect(processes, process) {
      return findIndex(processes, function(a){ return a.name === process.name }).cata({
        Nothing: function() {
          return processes.concat([{ name: process.name, pids: [process.pid] }]);
        },
        Just: function(index) {
          var item = processes[index];
  
          return processes.slice(0, index)
                          .concat([{ name: process.name, pids: item.pids.concat([process.pid]) }])
                          .concat(processes.slice(index + 1));
        }
      });
    }
  }
docs: :: [{ name: String, pid: Number }] -> [{ name: String, pids: [Number] }]