# All files / src/extensions Relude_Extensions_Ord.bs.js

72% Statements 90/125
100% Branches 10/10
52.17% Functions 24/46
72% Lines 90/125

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280

    25x
    25x

    14x
    14x
    9x

    5x

    6x
    6x
    3x

    3x

    2x

    5x

    2x

    24x

    17x

    4x

    4x
    3x

    1x

    14x
    14x
    8x

    6x

    3x
    3x
    2x

    1x

    49x
    23x

    49x
    5x

    49x
    2x

    49x
    2x

    49x
    2x

    49x
    2x

    49x
    3x

    49x
    4x

    49x
    4x

    49x
    34x
    14x

    34x
    3x

    34x

    49x

    25x

    25x

    25x

    25x

    25x

    25x

    25x

    25x

    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x
    25x

     'use strict';

    var Curry = require("bs-platform/lib/js/curry.js");
    var Relude_Ordering = require("../Relude_Ordering.bs.js");

    function compareAsIntBy(compare, a, b) {
      return Relude_Ordering.toInt(Curry._2(compare, a, b));
    }

    function compareAsInt(ord, a, b) {
      return Relude_Ordering.toInt(Curry._2(ord[/* compare */1], a, b));
    }

    function minBy(compare, a, b) {
      var match = Curry._2(compare, a, b);
      if (match !== 159039494) {
        return a;
      } else {
        return b;
      }
    }

    function min(ord, a, b) {
      return minBy(ord[/* compare */1], a, b);
    }

    function maxBy(compare, a, b) {
      var match = Curry._2(compare, a, b);
      if (match >= 939214151) {
        return b;
      } else {
        return a;
      }
    }

    function max(ord, a, b) {
      return maxBy(ord[/* compare */1], a, b);
    }

    function lessThanBy(compare, a, b) {
      return Curry._2(compare, a, b) === /* less_than */939214151;
    }

    function lessThan(ord, a, b) {
      return lessThanBy(ord[/* compare */1], a, b);
    }

    function lessThanOrEqBy(compare, a, b) {
      return Curry._2(compare, a, b) !== /* greater_than */159039494;
    }

    function lessThanOrEq(ord, a, b) {
      return lessThanOrEqBy(ord[/* compare */1], a, b);
    }

    function greaterThanBy(compare, a, b) {
      return Curry._2(compare, a, b) === /* greater_than */159039494;
    }

    function greaterThan(ord, a, b) {
      return greaterThanBy(ord[/* compare */1], a, b);
    }

    function greaterThanOrEqBy(compare, a, b) {
      return Curry._2(compare, a, b) !== /* less_than */939214151;
    }

    function greaterThanOrEq(ord, a, b) {
      return greaterThanOrEqBy(ord[/* compare */1], a, b);
    }

    function clampBy(compare, min, max, v) {
      return minBy(compare, max, maxBy(compare, min, v));
    }

    function clamp(ord, min, max, x) {
      return clampBy(ord[/* compare */1], min, max, x);
    }

    function betweenBy(compare, min, max, v) {
      if (greaterThanOrEqBy(compare, v, min)) {
        return lessThanOrEqBy(compare, v, max);
      } else {
        return false;
      }
    }

    function between(ord, min, max, x) {
      return betweenBy(ord[/* compare */1], min, max, x);
    }

    function abs(ord, ring, x) {
      var match = greaterThanOrEq(ord, x, ring[/* zero */1]);
      if (match) {
        return x;
      } else {
        return Curry._2(ring[/* subtract */4], ring[/* zero */1], x);
      }
    }

    function signum(ord, ring, x) {
      var match = greaterThanOrEq(ord, x, ring[/* zero */1]);
      if (match) {
        return ring[/* one */3];
      } else {
        return Curry._2(ring[/* subtract */4], ring[/* zero */1], ring[/* one */3]);
      }
    }

    function OrdExtensions(O) {
      var compareAsInt = function (a, b) {
        return Relude_Ordering.toInt(Curry._2(O[/* compare */1], a, b));
      };
      var min = function (a, b) {
        return minBy(O[/* compare */1], a, b);
      };
      var max = function (a, b) {
        return maxBy(O[/* compare */1], a, b);
      };
      var lessThan = function (a, b) {
        return lessThanBy(O[/* compare */1], a, b);
      };
      var lessThanOrEq = function (a, b) {
        return lessThanOrEqBy(O[/* compare */1], a, b);
      };
      var greaterThan = function (a, b) {
        return greaterThanBy(O[/* compare */1], a, b);
      };
      var greaterThanOrEq = function (a, b) {
        return greaterThanOrEqBy(O[/* compare */1], a, b);
      };
      var clamp = function (min, max, v) {
        return clampBy(O[/* compare */1], min, max, v);
      };
      var between = function (min, max, v) {
        return betweenBy(O[/* compare */1], min, max, v);
      };
      var OrdRingExtensions = function (R) {
        var abs$1 = function (v) {
          return abs(O, R, v);
        };
        var signum$1 = function (v) {
          return signum(O, R, v);
        };
        return /* module */[
                /* abs */abs$1,
                /* signum */signum$1
              ];
      };
      return /* module */[
              /* compareAsInt */compareAsInt,
              /* min */min,
              /* max */max,
              /* lessThan */lessThan,
              /* lessThanOrEq */lessThanOrEq,
              /* greaterThan */greaterThan,
              /* greaterThanOrEq */greaterThanOrEq,
              /* lt */lessThan,
              /* lte */lessThanOrEq,
              /* gt */greaterThan,
              /* gte */greaterThanOrEq,
              /* clamp */clamp,
              /* between */between,
              /* OrdRingExtensions */OrdRingExtensions
            ];
    }

    function OrdInfix(O) {
      var compareAsInt = function (a, b) {
        return Relude_Ordering.toInt(Curry._2(O[/* compare */1], a, b));
      };
      var min = function (a, b) {
        return minBy(O[/* compare */1], a, b);
      };
      var max = function (a, b) {
        return maxBy(O[/* compare */1], a, b);
      };
      var lessThan = function (a, b) {
        return lessThanBy(O[/* compare */1], a, b);
      };
      var lessThanOrEq = function (a, b) {
        return lessThanOrEqBy(O[/* compare */1], a, b);
      };
      var greaterThan = function (a, b) {
        return greaterThanBy(O[/* compare */1], a, b);
      };
      var greaterThanOrEq = function (a, b) {
        return greaterThanOrEqBy(O[/* compare */1], a, b);
      };
      var clamp = function (min, max, v) {
        return clampBy(O[/* compare */1], min, max, v);
      };
      var between = function (min, max, v) {
        return betweenBy(O[/* compare */1], min, max, v);
      };
      var OrdRingExtensions = function (R) {
        var abs$1 = function (v) {
          return abs(O, R, v);
        };
        var signum$1 = function (v) {
          return signum(O, R, v);
        };
        return /* module */[
                /* abs */abs$1,
                /* signum */signum$1
              ];
      };
      var OrdExtensions = /* module */[
        /* compareAsInt */compareAsInt,
        /* min */min,
        /* max */max,
        /* lessThan */lessThan,
        /* lessThanOrEq */lessThanOrEq,
        /* greaterThan */greaterThan,
        /* greaterThanOrEq */greaterThanOrEq,
        /* lt */lessThan,
        /* lte */lessThanOrEq,
        /* gt */greaterThan,
        /* gte */greaterThanOrEq,
        /* clamp */clamp,
        /* between */between,
        /* OrdRingExtensions */OrdRingExtensions
      ];
      return /* module */[
              /* OrdExtensions */OrdExtensions,
              /* |<| */lessThan,
              /* |<=| */lessThanOrEq,
              /* |>| */greaterThan,
              /* |>=| */greaterThanOrEq
            ];
    }

    var ltBy = lessThanBy;

    var lt = lessThan;

    var lteBy = lessThanOrEqBy;

    var lte = lessThanOrEq;

    var gtBy = greaterThanBy;

    var gt = greaterThan;

    var gteBy = greaterThanOrEqBy;

    var gte = greaterThanOrEq;

    exports.compareAsIntBy = compareAsIntBy;
    exports.compareAsInt = compareAsInt;
    exports.minBy = minBy;
    exports.min = min;
    exports.maxBy = maxBy;
    exports.max = max;
    exports.lessThanBy = lessThanBy;
    exports.ltBy = ltBy;
    exports.lessThan = lessThan;
    exports.lt = lt;
    exports.lessThanOrEqBy = lessThanOrEqBy;
    exports.lteBy = lteBy;
    exports.lessThanOrEq = lessThanOrEq;
    exports.lte = lte;
    exports.greaterThanBy = greaterThanBy;
    exports.gtBy = gtBy;
    exports.greaterThan = greaterThan;
    exports.gt = gt;
    exports.greaterThanOrEqBy = greaterThanOrEqBy;
    exports.gteBy = gteBy;
    exports.greaterThanOrEq = greaterThanOrEq;
    exports.gte = gte;
    exports.clampBy = clampBy;
    exports.clamp = clamp;
    exports.betweenBy = betweenBy;
    exports.between = between;
    exports.abs = abs;
    exports.signum = signum;
    exports.OrdExtensions = OrdExtensions;
    exports.OrdInfix = OrdInfix;
    /* No side effect */