main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
589 bytes
|
Line | |
---|
1 | import {
|
---|
2 | useWith,
|
---|
3 | curry,
|
---|
4 | curryN,
|
---|
5 | equals,
|
---|
6 | path,
|
---|
7 | either,
|
---|
8 | complement,
|
---|
9 | } from 'ramda';
|
---|
10 |
|
---|
11 | // type :: Monad a => a -> String
|
---|
12 | export const type = either(path(['@@type']), path(['constructor', '@@type']));
|
---|
13 |
|
---|
14 | // typeEquals :: Monad a => String -> a -> Boolean
|
---|
15 | export const typeEquals = curry(
|
---|
16 | (typeIdent, monad) => type(monad) === typeIdent
|
---|
17 | );
|
---|
18 |
|
---|
19 | // isSameType :: (Monad a, Monad b) => a -> b -> Boolean
|
---|
20 | export const isSameType = curryN(2, useWith(equals, [type, type]));
|
---|
21 |
|
---|
22 | // isNotSameType :: (Monad a, Monad b) => a -> b -> Boolean
|
---|
23 | export const isNotSameType = complement(isSameType);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.