<commit_before>package lila.db

import api._

import play.api.libs.iteratee._

object Typecheck {

  private def iteratee[A]: Iteratee[A, Unit] = {

    def step(input: Input[A]): Iteratee[A, Unit] = input match {
      case Input.EOF                       ⇒ Done((), Input.EOF)
      case Input.Empty | Input.El(Some(_)) ⇒ Cont(i ⇒ step(i))
      case Input.El(_)                     ⇒ Error("Type error", input)
    }
    Cont(i ⇒ step(i))
  }

  def apply[A: TubeInColl]: Fu[String] =
    $cursor[A]($select.all).enumerate run iteratee inject "Typecheck complete"
}<commit_msg>db typecheck that stops on error<commit_after>package lila.db

import api._

import play.api.libs.iteratee._

object Typecheck {

  private def iteratee[A](stop: Boolean): Iteratee[A, Unit] = {

    def step(input: Input[A]): Iteratee[A, Unit] = input match {
      case Input.EOF                       ⇒ Done((), Input.EOF)
      case Input.Empty | Input.El(Some(_)) ⇒ Cont(i ⇒ step(i))
      case Input.El(_)                     ⇒ 
      if (stop) Error("Type error", input)
      else Cont(i => step(i))
    }
    Cont(i ⇒ step(i))
  }

  def apply[A: TubeInColl]: Fu[String] = apply(true)

  def apply[A: TubeInColl](stop: Boolean): Fu[String] =
    $cursor[A]($select.all).enumerate run iteratee(stop) inject "Typecheck complete"
}
{'fraction_non_alphanumeric': 0.1466565349544073, 'fraction_numerical': 0.0, 'mean_word_length': 2.67877094972067, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6594988', 'n_tokens_mistral': 466, 'n_tokens_neox': 464, 'n_words': 119}