<commit_before>package funpep

import java.nio.file.Path
import java.util.UUID.randomUUID

import scalaz._
import scalaz.concurrent._
import scalaz.stream._
import scalaz.syntax.foldable._

import data._
import util.ops.path._
import util.ops.foldable._


object MergeSplitter {

  def mergeSplit[A](cmp: Fasta[A], ref: Fasta[A])(implicit ev: A ⇒ Compound): EphemeralStream[Fasta[A]] =
    cmp.entries.toEphemeralStream.map(entry ⇒ Fasta(entry <:: ref.entries))

  def saveSplits[A, F[_]: Foldable](directory: Path)(splits: F[Fasta[A]]): Process[Task, Unit] =
    merge.mergeN(splits.toProcess map {
      _.toFile(directory / randomUUID.toString + ".fasta")
    })

}
<commit_msg>Add apply/function syntax to MergeSplitter<commit_after>package funpep

import java.nio.file.Path
import java.util.UUID.randomUUID

import scalaz._
import scalaz.concurrent._
import scalaz.stream._
import scalaz.syntax.foldable._

import data._
import util.ops.path._
import util.ops.foldable._


object MergeSplitter {

  def apply[A](cmp: Fasta[A], ref: Fasta[A], dir: Path)(implicit ev: A ⇒ Compound): Process[Task, Path] =
    saveSplits(dir) { mergeSplit(cmp, ref) }

  def mergeSplit[A](cmp: Fasta[A], ref: Fasta[A])(implicit ev: A ⇒ Compound): EphemeralStream[Fasta[A]] =
    cmp.entries.toEphemeralStream.map(entry ⇒ Fasta(entry <:: ref.entries))

  def saveSplit[A](directory: Path)(split: Fasta[A]): Process[Task, Path] = {
    val path = directory / randomUUID.toString + ".fasta"
    split.toFile(path).map(_ ⇒ path)
  }

  def saveSplits[A, F[_]: Foldable](directory: Path)(splits: ⇒ F[Fasta[A]]): Process[Task, Path] =
    merge.mergeN { splits.toProcess map saveSplit(directory) }

}

{'fraction_non_alphanumeric': 0.14464285714285716, 'fraction_numerical': 0.0, 'mean_word_length': 4.756849315068493, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1451738', 'n_tokens_mistral': 617, 'n_tokens_neox': 603, 'n_words': 132}