ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
24 lines (19 loc) • 589 B
JavaScript
import {
useWith,
curry,
curryN,
equals,
path,
either,
complement,
} from 'ramda';
// type :: Monad a => a -> String
export const type = either(path(['@@type']), path(['constructor', '@@type']));
// typeEquals :: Monad a => String -> a -> Boolean
export const typeEquals = curry(
(typeIdent, monad) => type(monad) === typeIdent
);
// isSameType :: (Monad a, Monad b) => a -> b -> Boolean
export const isSameType = curryN(2, useWith(equals, [type, type]));
// isNotSameType :: (Monad a, Monad b) => a -> b -> Boolean
export const isNotSameType = complement(isSameType);