How to use the sanctuary.equals function in sanctuary

To help you get started, we’ve selected a few sanctuary 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 / src / signature.js View on Github external
[typeEq ('list'), convertList],
      [typeEq ('record'), convertRecord],
      [typeEq ('constrainedType'), convertConstrainedType],
      [typeEq ('typevar'), S.pipe ([convertTypevar, Reader.of])],
      [typeEq ('thunk'), S.K (Reader.of (Thunk))],
      [S.K (true), e => {
        throw new Error
          (`Don't know what to do with signature entry ${e.type}`);
      }],
    ]) (entry));

  //    convertTypes :: Array SignatureEntry -> Reader (TypeMap (Array Type))
  const convertTypes = memoize (S.pipe ([
      S.map (convertType),
      S.unchecked.sequence (Reader),
      S.unchecked.map (S.reject (S.equals (Thunk))),
    ]));

  //    convertTypeConstructor :: SignatureEntry -> Reader (TypeMap Type)
  const convertTypeConstructor = memoize (S.ifElse
    (hasChildren)
    (y => S.pipe ([
      children,
      convertTypes,
      x => S.unchecked.lift2 (constructType) (x) (lookupType (y)),
    ]) (y))
    (lookupType));

  //    convertList :: SignatureEntry -> Reader (TypeMap Type)
  const convertList = memoize (S.pipe ([
    firstChild,
    convertType,
github Risto-Stevcev / lazy-either / src / either.js View on Github external
this._value(res => {
    other._value(S.compose(resolve, S.equals(res)))
  })
}
github voorhoede / playbook / src / fetch-papers.js View on Github external
dotenv.config();

const dropboxPaperApi = got.extend({
  method: 'POST',
  baseUrl: 'https://api.dropbox.com/2/paper/',
  json: true,
  headers: {
    Authorization: `Bearer ${process.env.DROPBOX_API_TOKEN}`,
  },
});

const jsonToFrontmatter = json => `---\n${ JSON.stringify(json, null, 2) }\n---\n`;

const isDeletedDoc = pipe([
  props(['metaData', 'status', '.tag']),
  equals('deleted'),
]);

const {
  fetchAllDocIds,
  fetchDocFolders,
  fetchDocContent,
  fetchDocMetaData,
  foldersToPath,
} = main(dropboxPaperApi);

const appendDocContent = docs => Promise.all(
  docs.map(doc =>
    promiseAllProps({
      ...doc,
      content: fetchDocContent(doc.id),
    })