<commit_before>import { monad_apply, chain, mjoin, pointMaker, equalMaker, stringMaker, valueOf } from '../data_structure_util';

function Validation(val) {
    return Object.create(validation, {
        _value: {
            value: val
        }
    });
}

Validation.of = function _of(val) {
    return Validation(val);
};

/**
 * @sig
 * @description d
 * @param {Object} f - a
 * @return {boolean} - b
 */
Validation.is = f => validation.isPrototypeOf(f);

var validation = {
    map: function _map(fn) {
        return this.of(fn(this.value));
    },
    of: pointMaker(Validation),
    valueOf: valueOf,
    toString: stringMaker('Validation'),
    factory: Validation
};

/**
 * @sig
 * @description d
 * @return {boolean} - a
 */
validation.equals = equalMaker(validation);

/**
 * @sig
 * @description Since the constant functor does not represent a disjunction, the Validation's
 * bimap function property behaves just as its map function property. It is merely here as a
 * convenience so that swapping out functors/monads does not break an application that is
 * relying on its existence.
 * @type {function}
 * @param {function} f - a
 * @param {function} g - b
 * @return {validation} - c
 */
validation.bimap = validation.map;

validation.chain = chain;
validation.mjoin = mjoin;
validation.apply = monad_apply;

//Since FantasyLand is the defacto standard for JavaScript algebraic data structures, and I want to maintain
//compliance with the standard, a .constructor property must be on the container delegators. In this case, its
//just an alias for the true .factory property, which points to the delegator factory. I am isolating this from
//the actual delegator itself as it encourages poor JavaScript development patterns and ... the myth of Javascript
//classes and inheritance. I do not recommend using the .constructor property at all since that just encourages
//FantasyLand and others to continue either not learning how JavaScript actually works, or refusing to use it
//as it was intended... you know, like <NAME> and his "good parts", which is really just another
//way of saying: "your too dumb to understand how JavaScript works, and I either don't know myself, or don't
//care to know, so just stick with what I tell you to use."
validation.constructor = validation.factory;<commit_msg>develop: added refactored equals to validation data structure<commit_after>import { monad_apply, chain, mjoin, pointMaker, equals, stringMaker, valueOf } from '../data_structure_util';

function Validation(val) {
    return Object.create(validation, {
        _value: {
            value: val
        }
    });
}

Validation.of = function _of(val) {
    return Validation(val);
};

/**
 * @sig
 * @description d
 * @param {Object} f - a
 * @return {boolean} - b
 */
Validation.is = f => validation.isPrototypeOf(f);

var validation = {
    map: function _map(fn) {
        return this.of(fn(this.value));
    },
    of: pointMaker(Validation),
    valueOf: valueOf,
    equals: equals,
    toString: stringMaker('Validation'),
    factory: Validation
};

/**
 * @signature
 * @description Since the constant functor does not represent a disjunction, the Validation's
 * bimap function property behaves just as its map function property. It is merely here as a
 * convenience so that swapping out functors/monads does not break an application that is
 * relying on its existence.
 * @type {function}
 * @param {function} f - a
 * @param {function} g - b
 * @return {validation} - c
 */
validation.bimap = validation.map;

validation.chain = chain;
validation.mjoin = mjoin;
validation.apply = monad_apply;

//Since FantasyLand is the defacto standard for JavaScript algebraic data structures, and I want to maintain
//compliance with the standard, a .constructor property must be on the container delegators. In this case, its
//just an alias for the true .factory property, which points to the delegator factory. I am isolating this from
//the actual delegator itself as it encourages poor JavaScript development patterns and ... the myth of Javascript
//classes and inheritance. I do not recommend using the .constructor property at all since that just encourages
//FantasyLand and others to continue either not learning how JavaScript actually works, or refusing to use it
//as it was intended... you know, like <NAME> and his "good parts", which is really just another
//way of saying: "your too dumb to understand how JavaScript works, and I either don't know myself, or don't
//care to know, so just stick with what I tell you to use."
validation.constructor = validation.factory;
{'fraction_non_alphanumeric': 0.09252823631624674, 'fraction_numerical': 0.0, 'mean_word_length': 3.7279260780287475, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2751765', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1209, 'n_words': 556}