Skip to content

Instantly share code, notes, and snippets.

@tonyonodi
Last active January 18, 2020 22:17
Show Gist options
  • Save tonyonodi/da0bc0f37fb5655ff38fb66d888ff228 to your computer and use it in GitHub Desktop.
Save tonyonodi/da0bc0f37fb5655ff38fb66d888ff228 to your computer and use it in GitHub Desktop.
const getLongestSemigroup = <
A extends { length: number } = never
>(): S.Semigroup<A> => {
return { concat: (x, y) => (x.length > y.length ? x : y) };
};
const getLongestOptionSemigroup = O.getMonoid<Unit>(getLongestSemigroup());
const longestString = getLongestOptionSemigroup.concat(
string1Opt,
string2Opt
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment