@ryandur/sand
    Preparing search index...

    Function lawsOf

    • The law harness: hand it your type's unit and an equality, get back the functor and monad laws as runnable assertions. The constraint is the entry fee — your type must already be the capabilities it claims. The shipped containers prove themselves with it in their own suites; a type you mint yourself proves its laws the same way.

      const laws = lawsOf<Mine, void>(mine, (left, right) => expect(left.value).toEqual(right.value));
      laws.leftIdentity();
      laws.rightIdentity(mine(3));
      laws.associativity(mine(3));
      laws.mapIdentity(mine(3));
      laws.mapComposition(mine(3));

      Type Parameters

      • M extends Functor<number, M> & Monad<number, M>
      • VERDICT extends void | Promise<void>

      Parameters

      • unit: (value: number) => M
      • eq: (left: M, right: M) => VERDICT

      Returns {
          associativity: (m: M) => VERDICT;
          leftIdentity: () => VERDICT;
          mapComposition: (m: M) => VERDICT;
          mapIdentity: (m: M) => VERDICT;
          rightIdentity: (m: M) => VERDICT;
      }