<commit_before>require "spec_helper"
include Ribimaybe::Maybe

describe "Applicative Instance" do

  let(:ap) do
    ->(f, a){ f.(a) }.curry
  end

  let(:id) do
    ->(x){ x }
  end

  let(:dot) do
    ->(f, g){ ->(x){ f.(g.(x)) } }
  end

  let(:f) do
    ->(x){ ->(y) { x } }.(SecureRandom.base64(1000)).extend(Composable)
  end

  let(:g) do
    ->(x){ ->(y) { x } }.(SecureRandom.base64(1000)).extend(Composable)
  end

  describe "identity" do
    context "when i have nothing" do
      it "should give me back nothing" do
        expect(pure(&id).apply(Nothing)).to eq(Nothing)
      end<commit_msg>add todo.<commit_after>require "spec_helper"
include Ribimaybe::Maybe

describe "Applicative Instance" do

  let(:ap) do
    # TODO: passing a fn as an arg shouldn't need to be explicitly curried
    #       like this.
    #
    ->(f, a){ f.(a) }.curry
  end

  let(:id) do
    ->(x){ x }
  end

  let(:dot) do
    ->(f, g){ ->(x){ f.(g.(x)) } }
  end

  let(:f) do
    ->(x){ ->(y) { x } }.(SecureRandom.base64(1000)).extend(Composable)
  end

  let(:g) do
    ->(x){ ->(y) { x } }.(SecureRandom.base64(1000)).extend(Composable)
  end

  describe "identity" do
    context "when i have nothing" do
      it "should give me back nothing" do
        expect(pure(&id).apply(Nothing)).to eq(Nothing)
      end
{'fraction_non_alphanumeric': 0.18673780487804878, 'fraction_numerical': 0.018292682926829267, 'mean_word_length': 2.6675977653631286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '1763117', 'n_tokens_mistral': 534, 'n_tokens_neox': 496, 'n_words': 135}