Skip to content

Instantly share code, notes, and snippets.

@reidev275
Last active February 26, 2020 13:08
Show Gist options
  • Save reidev275/cfae1b90ca4183d3fce73bbcd887b9d6 to your computer and use it in GitHub Desktop.
Save reidev275/cfae1b90ca4183d3fce73bbcd887b9d6 to your computer and use it in GitHub Desktop.
export const equals = <A, K extends keyof A>(field: K, val: A[K]): Filter<A> => ({
kind: "Equals",
field,
val
});
export const greater = <A, K extends keyof A>(field: K, val: A[K]): Filter<A> => ({
kind: "Greater",
field,
val
});
export const less = <A, K extends keyof A>(field: K, val: A[K]): Filter<A> => ({
kind: "Less",
field,
val
});
export const and = <A>(a: Filter<A>, b: Filter<A>): Filter<A> => ({
kind: "And",
a,
b
});
export const or = <A>(a: Filter<A>, b: Filter<A>): Filter<A> => ({
kind: "Or",
a,
b
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment