<commit_before>/**
 * @flow
 */

export type Maybe<A> = Just<A> | Nothing

type AnyVal = number | boolean | string | Object

class Just<A> {

  value: A

  constructor(value: $NonMaybeType<A>) {
    this.value = value
  }

  filter(p: (A) => boolean): Maybe<A> {
    if (p(this.value)) {
      return this
    } else {
      return nothing
    }
  }

  flatMap<B: AnyVal>(f: (A) => Maybe<B>): Maybe<B> {
    const result = f(this.value)
    return isNil(result) ? nothing : result
  }

  forEach<B>(f: (A) => B) {
    f(this.value)
  }<commit_msg>Sync up type def with source file<commit_after>/**
 * @flow
 */

export type Maybe<A> = Just<A> | Nothing

type AnyVal = number | boolean | string | Object | Array<*>

class Just<A> {

  value: A

  constructor(value: $NonMaybeType<A>) {
    this.value = value
  }

  filter(p: (A) => boolean): Maybe<A> {
    if (p(this.value)) {
      return this
    } else {
      return nothing
    }
  }

  flatMap<B: AnyVal>(f: (A) => Maybe<B>): Maybe<B> {
    const result = f(this.value)
    return isNil(result) ? nothing : result
  }

  forEach<B>(f: (A) => B) {
    f(this.value)
  }
{'fraction_non_alphanumeric': 0.17066666666666666, 'fraction_numerical': 0.0, 'mean_word_length': 2.6677524429967425, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 28, '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': '2300541', 'n_tokens_mistral': 433, 'n_tokens_neox': 419, 'n_words': 103}