# All files / src Relude_OptionT.bs.js

95.38% Statements 62/65
50% Branches 1/2
88.24% Functions 15/17
95.38% Lines 62/65

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

    1x
    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x

    1x
    8x

    1x

    1x

    1x
    1x
    1x

    1x
    9x
    9x

    1x
    1x
    1x

    1x

    1x
    1x
    1x

    1x

    1x
    1x
    10x

    1x

    1x
    1x
    3x
    3x
    3x

    1x
    1x
    1x

    1x

    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x

    1x

    1x

     'use strict';

    var Curry = require("bs-platform/lib/js/curry.js");
    var Caml_option = require("bs-platform/lib/js/caml_option.js");
    var Relude_Option = require("./Relude_Option.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 WithMonad(M) {
      var make = function (mOptionA) {
        return /* OptionT */[mOptionA];
      };
      var runOptionT = function (param) {
        return param[0];
      };
      var mapOptionT = function (mOptionAToMOptionB, param) {
        return /* OptionT */[Curry._1(mOptionAToMOptionB, param[0])];
      };
      var fromOption = function (optionA) {
        return /* OptionT */[Curry._1(M.pure, optionA)];
      };
      var liftF = function (mA) {
        return /* OptionT */[Curry._2(M.map, (function (a) {
                        return Caml_option.some(a);
                      }), mA)];
      };
      var map = function (aToB, param) {
        return /* OptionT */[Curry._2(M.map, (function (optionA) {
                        return Relude_Option.map(aToB, optionA);
                      }), param[0])];
      };
      var subflatMap = function (aToB, param) {
        return /* OptionT */[Curry._2(M.map, (function (optionA) {
                        return Curry._2(Relude_Option.flatMap, aToB, optionA);
                      }), param[0])];
      };
      var Functor = {
        map: map
      };
      var include = Relude_Extensions_Functor.FunctorExtensions(Functor);
      var apply = function (param, param$1) {
        return /* OptionT */[Curry._2(M.apply, Curry._2(M.map, Relude_Option.apply, param[0]), param$1[0])];
      };
      var Apply = {
        map: map,
        apply: apply
      };
      var include$1 = Relude_Extensions_Apply.ApplyExtensions(Apply);
      var pure = function (a) {
        return /* OptionT */[Curry._1(M.pure, Caml_option.some(a))];
      };
      var Applicative = {
        map: map,
        apply: apply,
        pure: pure
      };
      var include$2 = Relude_Extensions_Applicative.ApplicativeExtensions(Applicative);
      var bind = function (param, aToOptionTB) {
        return /* OptionT */[Curry._2(M.flat_map, param[0], (function (optionA) {
                        Eif (optionA !== undefined) {
                          return Curry._1(aToOptionTB, Caml_option.valFromOption(optionA))[0];
                        } else {
                          return Curry._1(M.pure, undefined);
                        }
                      }))];
      };
      var semiflatMap = function (aToMB, optionTA) {
        return bind(optionTA, (function (a) {
                      return liftF(Curry._1(aToMB, a));
                    }));
      };
      var Monad = {
        map: map,
        apply: apply,
        pure: pure,
        flat_map: bind
      };
      var include$3 = Relude_Extensions_Monad.MonadExtensions(Monad);
      var include$4 = Relude_Extensions_Functor.FunctorInfix(Functor);
      var include$5 = Relude_Extensions_Apply.ApplyInfix(Apply);
      var include$6 = Relude_Extensions_Monad.MonadInfix(Monad);
      var Infix_FunctorExtensions = include$4.FunctorExtensions;
      var Infix_$less$dollar$great = include$4.$less$$great;
      var Infix_$less$hash$great = include$4.$less$hash$great;
      var Infix_$less$dollar = include$4.$less$;
      var Infix_$$great = include$4.$$great;
      var Infix_$less$at$great = include$4.$less$at$great;
      var Infix_ApplyExtensions = include$5.ApplyExtensions;
      var Infix_$less$star$great = include$5.$less$star$great;
      var Infix_$less$star = include$5.$less$star;
      var Infix_$star$great = include$5.$star$great;
      var Infix_MonadExtensions = include$6.MonadExtensions;
      var Infix_$great$great$eq = include$6.$great$great$eq;
      var Infix_$eq$less$less = include$6.$eq$less$less;
      var Infix_$great$eq$great = include$6.$great$eq$great;
      var Infix_$less$eq$less = include$6.$less$eq$less;
      var Infix = {
        FunctorExtensions: Infix_FunctorExtensions,
        $less$$great: Infix_$less$dollar$great,
        $less$hash$great: Infix_$less$hash$great,
        $less$: Infix_$less$dollar,
        $$great: Infix_$$great,
        $less$at$great: Infix_$less$at$great,
        ApplyExtensions: Infix_ApplyExtensions,
        $less$star$great: Infix_$less$star$great,
        $less$star: Infix_$less$star,
        $star$great: Infix_$star$great,
        MonadExtensions: Infix_MonadExtensions,
        $great$great$eq: Infix_$great$great$eq,
        $eq$less$less: Infix_$eq$less$less,
        $great$eq$great: Infix_$great$eq$great,
        $less$eq$less: Infix_$less$eq$less
      };
      return {
              make: make,
              runOptionT: runOptionT,
              mapOptionT: mapOptionT,
              fromOption: fromOption,
              liftF: liftF,
              map: map,
              subflatMap: subflatMap,
              Functor: Functor,
              BsFunctorExtensions: include.BsFunctorExtensions,
              flipMap: include.flipMap,
              $$void: include.$$void,
              voidRight: include.voidRight,
              voidLeft: include.voidLeft,
              flap: include.flap,
              apply: apply,
              Apply: Apply,
              BsApplyExtensions: include$1.BsApplyExtensions,
              applyFirst: include$1.applyFirst,
              applySecond: include$1.applySecond,
              map2: include$1.map2,
              map3: include$1.map3,
              map4: include$1.map4,
              map5: include$1.map5,
              tuple2: include$1.tuple2,
              tuple3: include$1.tuple3,
              tuple4: include$1.tuple4,
              tuple5: include$1.tuple5,
              mapTuple2: include$1.mapTuple2,
              mapTuple3: include$1.mapTuple3,
              mapTuple4: include$1.mapTuple4,
              mapTuple5: include$1.mapTuple5,
              pure: pure,
              Applicative: Applicative,
              BsApplicativeExtensions: include$2.BsApplicativeExtensions,
              liftA1: include$2.liftA1,
              bind: bind,
              semiflatMap: semiflatMap,
              Monad: Monad,
              BsMonadExtensions: include$3.BsMonadExtensions,
              flatMap: include$3.flatMap,
              flatten: include$3.flatten,
              composeKleisli: include$3.composeKleisli,
              flipComposeKleisli: include$3.flipComposeKleisli,
              liftM1: include$3.liftM1,
              when_: include$3.when_,
              unless: include$3.unless,
              Infix: Infix
            };
    }

    exports.WithMonad = WithMonad;
    /* Relude_Option Not a pure module */