# All files / src Relude_AsyncData.bs.js

69.82% Statements 229/328
50.98% Branches 78/153
52.63% Functions 20/38
69.82% Lines 229/328

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
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633

    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x

    11x

    18x

    4x
    2x

    2x

    4x
    2x

    2x

    4x
    3x

    1x

    4x
    3x

    1x

    8x
    4x
    2x

    2x

    4x
    2x

    2x

    4x

    4x
    2x
    1x

    1x

    2x
    1x

    1x

    4x
    2x
    1x

    1x

    2x
    1x

    1x

    4x
    2x

    2x

    4x
    3x

    1x

    4x
    3x

    1x

    8x
    4x
    2x

    2x

    4x
    2x

    2x

    8x
    4x
    2x

    2x

    4x
    2x

    2x

    4x

    4x

    5x
    3x
    3x

    2x

    2x

    2x

    2x

    5x
    3x
    2x

    1x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    6x
    2x
    2x
    2x

    4x
    3x

    3x

    1x
    1x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x

    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x

     'use strict';

    var Block = require("bs-platform/lib/js/block.js");
    var Curry = require("bs-platform/lib/js/curry.js");
    var Caml_option = require("bs-platform/lib/js/caml_option.js");
    var Relude_Extensions_Alt = require("./extensions/Relude_Extensions_Alt.bs.js");
    var Relude_Extensions_Apply = require("./extensions/Relude_Extensions_Apply.bs.js");
    var Relude_Extensions_Monad = require("./extensions/Relude_Extensions_Monad.bs.js");
    var Relude_Extensions_Functor = require("./extensions/Relude_Extensions_Functor.bs.js");
    var Relude_Extensions_Applicative = require("./extensions/Relude_Extensions_Applicative.bs.js");

    function reloading(a) {
      return /* Reloading */Block.__(0, [a]);
    }

    function complete(a) {
      return /* Complete */Block.__(1, [a]);
    }

    function isInit(param) {
      if (typeof param === "number") {
        return param === 0;
      } else {
        return false;
      }
    }

    function isLoading(param) {
      if (typeof param === "number") {
        return param !== 0;
      } else {
        return false;
      }
    }

    function isReloading(param) {
      if (typeof param === "number" || param.tag) {
        return false;
      } else {
        return true;
      }
    }

    function isComplete(param) {
      if (typeof param === "number" || param.tag !== 1) {
        return false;
      } else {
        return true;
      }
    }

    function isBusy(param) {
      if (typeof param === "number") {
        if (param === 0) {
          return false;
        } else {
          return true;
        }
      } else if (param.tag) {
        return false;
      } else {
        return true;
      }
    }

    function isIdle(fa) {
      return !isBusy(fa);
    }

    function isEmpty(param) {
      if (typeof param === "number") {
        return true;
      } else {
        return false;
      }
    }

    function isNotEmpty(param) {
      if (typeof param === "number") {
        return false;
      } else {
        return true;
      }
    }

    function toBusy(a) {
      if (typeof a === "number") {
        if (a === 0) {
          return /* Loading */1;
        } else {
          return a;
        }
      } else if (a.tag) {
        return /* Reloading */Block.__(0, [a[0]]);
      } else {
        return a;
      }
    }

    function toIdle(a) {
      if (typeof a === "number") {
        if (a === 0) {
          return a;
        } else {
          return /* Init */0;
        }
      } else if (a.tag) {
        return a;
      } else {
        return /* Complete */Block.__(1, [a[0]]);
      }
    }

    function getValue(param) {
      if (typeof param === "number") {
        return undefined;
      } else {
        return Caml_option.some(param[0]);
      }
    }

    function getReloading(param) {
      if (typeof param === "number" || param.tag) {
        return undefined;
      } else {
        return Caml_option.some(param[0]);
      }
    }

    function getComplete(param) {
      if (typeof param === "number" || param.tag !== 1) {
        return undefined;
      } else {
        return Caml_option.some(param[0]);
      }
    }

    function fold(initValue, loadingValue, onReloading, onComplete, fa) {
      if (typeof fa === "number") {
        if (fa === 0) {
          return initValue;
        } else {
          return loadingValue;
        }
      } else if (fa.tag) {
        return Curry._1(onComplete, fa[0]);
      } else {
        return Curry._1(onReloading, fa[0]);
      }
    }

    function foldLazy(onInit, onLoading, onReloading, onComplete, fa) {
      if (typeof fa === "number") {
        if (fa === 0) {
          return Curry._1(onInit, /* () */0);
        } else {
          return Curry._1(onLoading, /* () */0);
        }
      } else if (fa.tag) {
        return Curry._1(onComplete, fa[0]);
      } else {
        return Curry._1(onReloading, fa[0]);
      }
    }

    function foldByValue(defaultValue, onValue, fa) {
      return fold(defaultValue, defaultValue, onValue, onValue, fa);
    }

    function foldByValueLazy(onNoValue, onValue, fa) {
      return foldLazy(onNoValue, onNoValue, onValue, onValue, fa);
    }

    function map(f, fa) {
      if (typeof fa === "number") {
        Eif (fa === 0) {
          return /* Init */0;
        } else {
          return /* Loading */1;
        }
      } else Iif (fa.tag) {
        return /* Complete */Block.__(1, [Curry._1(f, fa[0])]);
      } else {
        return /* Reloading */Block.__(0, [Curry._1(f, fa[0])]);
      }
    }

    var Functor = /* module */[/* map */map];

    var include = Relude_Extensions_Functor.FunctorExtensions(Functor);

    function tap(ifInit, ifLoading, ifReloading, ifComplete, fa) {
      if (typeof fa === "number") {
        if (fa === 0) {
          Curry._1(ifInit, /* () */0);
          return fa;
        } else {
          Curry._1(ifLoading, /* () */0);
          return fa;
        }
      } else if (fa.tag) {
        Curry._1(ifComplete, fa[0]);
        return fa;
      } else {
        Curry._1(ifReloading, fa[0]);
        return fa;
      }
    }

    function tapInit(ifInit, fa) {
      if (typeof fa === "number" && fa === 0) {
        Curry._1(ifInit, /* () */0);
        return fa;
      } else {
        return fa;
      }
    }

    function tapLoading(ifLoading, fa) {
      if (typeof fa === "number" && fa !== 0) {
        Curry._1(ifLoading, /* () */0);
        return fa;
      } else {
        return fa;
      }
    }

    function tapReloading(ifReloading, fa) {
      if (typeof fa === "number" || fa.tag) {
        return fa;
      } else {
        Curry._1(ifReloading, fa[0]);
        return fa;
      }
    }

    function tapComplete(ifComplete, fa) {
      if (typeof fa === "number" || fa.tag !== 1) {
        return fa;
      } else {
        Curry._1(ifComplete, fa[0]);
        return fa;
      }
    }

    function tapEmpty(ifEmpty, fa) {
      if (typeof fa === "number") {
        Curry._1(ifEmpty, /* () */0);
        return fa;
      } else {
        return fa;
      }
    }

    function tapNotEmpty(ifNotEmpty, fa) {
      if (typeof fa === "number") {
        return fa;
      } else {
        Curry._1(ifNotEmpty, fa[0]);
        return fa;
      }
    }

    function tapByValue(ifEmpty, ifNotEmpty, fa) {
      if (typeof fa === "number") {
        Curry._1(ifEmpty, /* () */0);
        return fa;
      } else {
        Curry._1(ifNotEmpty, fa[0]);
        return fa;
      }
    }

    function apply(ff, fa) {
      if (typeof ff === "number") {
        if (ff === 0 && !(typeof fa === "number" && fa !== 0)) {
          return /* Init */0;
        } else {
          return /* Loading */1;
        }
      } else Iif (ff.tag) {
        var f = ff[0];
        if (typeof fa === "number") {
          if (fa === 0) {
            return /* Init */0;
          } else {
            return /* Loading */1;
          }
        } else if (fa.tag) {
          return /* Complete */Block.__(1, [Curry._1(f, fa[0])]);
        } else {
          return /* Reloading */Block.__(0, [Curry._1(f, fa[0])]);
        }
      } else Iif (typeof fa === "number") {
        if (fa !== 0) {
          return /* Loading */1;
        } else {
          return /* Init */0;
        }
      } else {
        return /* Reloading */Block.__(0, [Curry._1(ff[0], fa[0])]);
      }
    }

    var Apply = /* module */[
      /* map */map,
      /* apply */apply
    ];

    var include$1 = Relude_Extensions_Apply.ApplyExtensions(Apply);

    function pure(a) {
      return /* Complete */Block.__(1, [a]);
    }

    var Applicative = /* module */[
      /* map */map,
      /* apply */apply,
      /* pure */pure
    ];

    var include$2 = Relude_Extensions_Applicative.ApplicativeExtensions(Applicative);

    function bind(fa, f) {
      if (typeof fa === "number") {
        if (fa !== 0) {
          return /* Loading */1;
        } else {
          return /* Init */0;
        }
      } else {
        return Curry._1(f, fa[0]);
      }
    }

    var Monad = /* module */[
      /* map */map,
      /* apply */apply,
      /* pure */pure,
      /* flat_map */bind
    ];

    var include$3 = Relude_Extensions_Monad.MonadExtensions(Monad);

    function alt(fa, fb) {
      if (typeof fa === "number") {
        if (fa === 0) {
          if (typeof fb === "number") {
            if (fb !== 0) {
              return /* Loading */1;
            } else {
              return /* Init */0;
            }
          } else {
            return fb;
          }
        } else if (typeof fb === "number") {
          return /* Loading */1;
        } else {
          return fb;
        }
      } else if (fa.tag || typeof fb === "number" || fb.tag !== 1) {
        return fa;
      } else {
        return fb;
      }
    }

    var Alt = /* module */[
      /* map */map,
      /* alt */alt
    ];

    Relude_Extensions_Alt.AltExtensions(Alt);

    function eqBy(innerEq, a, b) {
      if (typeof a === "number") {
        Eif (a === 0) {
          Eif (typeof b === "number") {
            return b === 0;
          } else {
            return false;
          }
        } else if (typeof b === "number") {
          return b !== 0;
        } else {
          return false;
        }
      } else if (a.tag) {
        Iif (typeof b === "number" || b.tag !== 1) {
          return false;
        } else {
          return Curry._2(innerEq, a[0], b[0]);
        }
      } else Eif (typeof b === "number" || b.tag) {
        return false;
      } else {
        return Curry._2(innerEq, a[0], b[0]);
      }
    }

    function Eq(E) {
      var partial_arg = E[/* eq */0];
      var eq = function (param, param$1) {
        return eqBy(partial_arg, param, param$1);
      };
      return /* module */[/* eq */eq];
    }

    function showBy(showA, fa) {
      if (typeof fa === "number") {
        if (fa === 0) {
          return "Init";
        } else {
          return "Loading";
        }
      } else if (fa.tag) {
        return "Complete(" + (Curry._1(showA, fa[0]) + ")");
      } else {
        return "Reloading(" + (Curry._1(showA, fa[0]) + ")");
      }
    }

    function Show(S) {
      var partial_arg = S[/* show */0];
      var show = function (param) {
        return showBy(partial_arg, param);
      };
      return /* module */[/* show */show];
    }

    var include$4 = Relude_Extensions_Functor.FunctorInfix(Functor);

    var include$5 = Relude_Extensions_Alt.AltInfix(Alt);

    var include$6 = Relude_Extensions_Apply.ApplyInfix(Apply);

    var include$7 = Relude_Extensions_Monad.MonadInfix(Monad);

    var Infix_000 = /* FunctorExtensions */include$4[0];

    var Infix_001 = /* <$> */include$4[1];

    var Infix_002 = /* <#> */include$4[2];

    var Infix_003 = /* <$ */include$4[3];

    var Infix_004 = /* $> */include$4[4];

    var Infix_005 = /* <@> */include$4[5];

    var Infix_006 = /* <|> */include$5[0];

    var Infix_007 = /* ApplyExtensions */include$6[0];

    var Infix_008 = /* <*> */include$6[1];

    var Infix_009 = /* <* */include$6[2];

    var Infix_010 = /* *> */include$6[3];

    var Infix_011 = /* MonadExtensions */include$7[0];

    var Infix_012 = /* >>= */include$7[1];

    var Infix_013 = /* =<< */include$7[2];

    var Infix_014 = /* >=> */include$7[3];

    var Infix_015 = /* <=< */include$7[4];

    var Infix = /* module */[
      Infix_000,
      Infix_001,
      Infix_002,
      Infix_003,
      Infix_004,
      Infix_005,
      Infix_006,
      Infix_007,
      Infix_008,
      Infix_009,
      Infix_010,
      Infix_011,
      Infix_012,
      Infix_013,
      Infix_014,
      Infix_015
    ];

    var init = /* Init */0;

    var loading = /* Loading */1;

    var BsFunctorExtensions = include[0];

    var flipMap = include[1];

    var $$void = include[2];

    var voidRight = include[3];

    var voidLeft = include[4];

    var flap = include[5];

    var BsApplyExtensions = include$1[0];

    var applyFirst = include$1[1];

    var applySecond = include$1[2];

    var map2 = include$1[3];

    var map3 = include$1[4];

    var map4 = include$1[5];

    var map5 = include$1[6];

    var tuple2 = include$1[7];

    var tuple3 = include$1[8];

    var tuple4 = include$1[9];

    var tuple5 = include$1[10];

    var mapTuple2 = include$1[11];

    var mapTuple3 = include$1[12];

    var mapTuple4 = include$1[13];

    var mapTuple5 = include$1[14];

    var BsApplicativeExtensions = include$2[0];

    var liftA1 = include$2[1];

    var BsMonadExtensions = include$3[0];

    var flatMap = include$3[1];

    var flatten = include$3[2];

    var composeKleisli = include$3[3];

    var flipComposeKleisli = include$3[4];

    var liftM1 = include$3[5];

    var when_ = include$3[6];

    var unless = include$3[7];

    exports.init = init;
    exports.loading = loading;
    exports.reloading = reloading;
    exports.complete = complete;
    exports.isInit = isInit;
    exports.isLoading = isLoading;
    exports.isReloading = isReloading;
    exports.isComplete = isComplete;
    exports.isBusy = isBusy;
    exports.isIdle = isIdle;
    exports.isEmpty = isEmpty;
    exports.isNotEmpty = isNotEmpty;
    exports.toBusy = toBusy;
    exports.toIdle = toIdle;
    exports.getValue = getValue;
    exports.getReloading = getReloading;
    exports.getComplete = getComplete;
    exports.fold = fold;
    exports.foldLazy = foldLazy;
    exports.foldByValue = foldByValue;
    exports.foldByValueLazy = foldByValueLazy;
    exports.map = map;
    exports.Functor = Functor;
    exports.BsFunctorExtensions = BsFunctorExtensions;
    exports.flipMap = flipMap;
    exports.$$void = $$void;
    exports.voidRight = voidRight;
    exports.voidLeft = voidLeft;
    exports.flap = flap;
    exports.tap = tap;
    exports.tapInit = tapInit;
    exports.tapLoading = tapLoading;
    exports.tapReloading = tapReloading;
    exports.tapComplete = tapComplete;
    exports.tapEmpty = tapEmpty;
    exports.tapNotEmpty = tapNotEmpty;
    exports.tapByValue = tapByValue;
    exports.apply = apply;
    exports.Apply = Apply;
    exports.BsApplyExtensions = BsApplyExtensions;
    exports.applyFirst = applyFirst;
    exports.applySecond = applySecond;
    exports.map2 = map2;
    exports.map3 = map3;
    exports.map4 = map4;
    exports.map5 = map5;
    exports.tuple2 = tuple2;
    exports.tuple3 = tuple3;
    exports.tuple4 = tuple4;
    exports.tuple5 = tuple5;
    exports.mapTuple2 = mapTuple2;
    exports.mapTuple3 = mapTuple3;
    exports.mapTuple4 = mapTuple4;
    exports.mapTuple5 = mapTuple5;
    exports.pure = pure;
    exports.Applicative = Applicative;
    exports.BsApplicativeExtensions = BsApplicativeExtensions;
    exports.liftA1 = liftA1;
    exports.bind = bind;
    exports.Monad = Monad;
    exports.BsMonadExtensions = BsMonadExtensions;
    exports.flatMap = flatMap;
    exports.flatten = flatten;
    exports.composeKleisli = composeKleisli;
    exports.flipComposeKleisli = flipComposeKleisli;
    exports.liftM1 = liftM1;
    exports.when_ = when_;
    exports.unless = unless;
    exports.alt = alt;
    exports.Alt = Alt;
    exports.eqBy = eqBy;
    exports.Eq = Eq;
    exports.showBy = showBy;
    exports.Show = Show;
    exports.Infix = Infix;
    /* include Not a pure module */