<commit_before>module Access.Record where

import Native.Access
import Debug

setter : (rec -> b) -> b -> rec -> rec
setter getter =
  Native.Access.makeRecordSetter getter

unsafeSetter : (oldRec -> b) -> new -> oldRec -> newRec
unsafeSetter getter =
  Native.Access.makeRecordSetter getter
<commit_msg>add updater functions for records<commit_after>module Access.Record where

import Native.Access
import Debug

setter : (rec -> b) -> b -> rec -> rec
setter getter =
  Native.Access.makeRecordSetter getter

unsafeSetter : (oldRec -> b) -> new -> oldRec -> newRec
unsafeSetter getter =
  Native.Access.makeRecordSetter getter

updater : (rec -> b) -> (b -> b) -> rec -> rec
updater =
  unsafeUpdater

unsafeUpdater : (oldRec -> b) -> (b -> new) -> oldRec -> newRec
unsafeUpdater getter update rec =
  let old = getter rec
      new = update old
      set = unsafeSetter getter
  in set new rec
{'fraction_non_alphanumeric': 0.11284916201117319, 'fraction_numerical': 0.0, 'mean_word_length': 3.370731707317073, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '7210077', 'n_tokens_mistral': 294, 'n_tokens_neox': 283, 'n_words': 92}