@dillonkearns/elm-graphql
Version:
<img src="https://cdn.jsdelivr.net/gh/martimatix/logo-graphqelm/logo.svg" alt="dillonearns/elm-graphql logo" width="40%" align="right">
16 lines (14 loc) • 331 B
Flow
// @flow
export interface Semigroup<A> {
concat(x: A, y: A): A
}
export function getProductSemigroup<A, B>(asemigroup: Semigroup<A>, bsemigroup: Semigroup<B>): Semigroup<[A, B]> {
return {
concat([xa, xb], [ya, yb]) {
return [
asemigroup.concat(xa, ya),
bsemigroup.concat(xb, yb)
]
}
}
}