How to use the sanctuary-def.BinaryType function in sanctuary-def

To help you get started, we’ve selected a few sanctuary-def examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xodio / hm-def / test / def.spec.js View on Github external
import {unchecked as S} from 'sanctuary';
import $ from 'sanctuary-def';
import Z from 'sanctuary-type-classes';
import {assert} from 'chai';
import {create} from '../src/index';

const hasProp = p => x => x[p] !== undefined;

const $Map = $.BinaryType
  ('Map')
  ('someurl')
  (S.is ($.Object))
  (S.keys)
  (S.values);

const $Wrapper = $.UnaryType
  ('Wrapper')
  ('someurl')
  (S.allPass ([S.is ($.Object), hasProp ('value')]))
  (S.pipe ([S.prop ('value'), S.of (Array)]));

const def = create ({
  $,
  checkTypes: true,
  env: $.env.concat ([