Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 1x 1x 1x 1x 36x 36x 36x 36x 36x 36x 36x 36x 36x 36x 36x 36x 36x 36x 36x 2942x 36x 36x 36x | import {Law} from '#law'
import type {SemigroupTypeLambda} from '@effect/typeclass/Semigroup'
import type {BuildConcrete} from './given.js'
import {defineConcreteLaws} from './given.js'
import {associativity} from '#algebra'
import {UnderlyingArbitrary} from '#arbitrary'
/**
* Build typeclass laws for `Semigroup`.
* @category typeclass laws
*/
export const semigroupLaws: BuildConcrete<SemigroupTypeLambda> = ({
F,
equalsA,
a,
suffix,
}) => {
type A = UnderlyingArbitrary<typeof a>
return defineConcreteLaws(
'Semigroup',
associativity<A>({a, f: F.combine, equals: equalsA}),
Law(
'combineMany associativity',
'combineMany(a, [b, c]) = combine(a, combine(b, c))',
a,
a,
a,
)((a, b, c) =>
equalsA(F.combineMany(a, [b, c]), F.combine(a, F.combine(b, c))),
),
)(suffix)
}
declare module './given.js' {
interface ConcreteLambdas {
Semigroup: SemigroupTypeLambda
}
}
|