You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.8 KiB
32 lines
1.8 KiB
import { _, _l, g, n } from './core';
|
|
import { GT, LT } from './ord';
|
|
import { False, True, and } from './bool';
|
|
import { fromString as _s } from './string';
|
|
|
|
n('pair');
|
|
|
|
export const Pair = g('Pair', _l(f => _l(s => _l(p => p._(f)._(s)))));
|
|
|
|
export const fst = g('fst', _l(p => p._(_l(f => _l(_ => f)))));
|
|
|
|
export const snd = g('snd', _l(p => p._(_l(_ => _l(s => s)))));
|
|
|
|
export const first = g('first', _l(t => _l(p => p._(_l(f => _l(s => Pair._(t._(f))._(s)))))));
|
|
|
|
export const second = g('second', _l(t => _l(p => p._(_l(f => _l(s => Pair._(f)._(t._(s))))))));
|
|
|
|
export const both = g('both', _l(tf => _l(ts => _l(p => p._(_l(f => _l(s => Pair._(tf._(f))._(ts._(s)))))))));
|
|
|
|
export const uncurry = g('uncurry', _l(t => _l(p => p._(t))));
|
|
|
|
export const cmp = g('cmp', _l(fcmp => _l(scmp => uncurry._(_l(lf => _l(ls => uncurry._(_l(rf => _l(rs => fcmp._(lf)._(rf)._(LT)._(scmp._(ls)._(rs))._(GT))))))))));
|
|
|
|
export const lt = g('lt', _l(fcmp => _l(scmp => uncurry._(_l(lf => _l(ls => uncurry._(_l(rf => _l(rs => fcmp._(lf)._(rf)._(True)._(scmp._(ls)._(rs)._(True)._(False)._(False))._(False))))))))));
|
|
|
|
export const le = g('le', _l(fcmp => _l(scmp => uncurry._(_l(lf => _l(ls => uncurry._(_l(rf => _l(rs => fcmp._(lf)._(rf)._(True)._(scmp._(ls)._(rs)._(True)._(True)._(False))._(False))))))))));
|
|
|
|
export const eq = g('eq', _l(feq => _l(seq => uncurry._(_l(lf => _l(ls => uncurry._(_l(rf => _l(rs => and._(feq._(lf)._(rf))._(seq._(ls)._(rs)))))))))));
|
|
|
|
export const ge = g('ge', _l(fcmp => _l(scmp => uncurry._(_l(lf => _l(ls => uncurry._(_l(rf => _l(rs => fcmp._(lf)._(rf)._(False)._(scmp._(ls)._(rs)._(False)._(True)._(True))._(True))))))))));
|
|
|
|
export const gt = g('gt', _l(fcmp => _l(scmp => uncurry._(_l(lf => _l(ls => uncurry._(_l(rf => _l(rs => fcmp._(lf)._(rf)._(False)._(scmp._(ls)._(rs)._(False)._(False)._(True))._(True))))))))));
|
|
|