<?php if (get_class($this) !== get_class($that)) {
throw new \Exception('CollectionTypeError::cannotMergeDifferentTypes');
}
return new static(array_merge($this->items, $that->items));
}
public function toArray(): array
<?php public function flatMap(callable $f): self
{
return new static(array_merge(...array_map($f, $this->items)));
}
public function reduce(callable $f, $initial = null)