/**
 * Definire un semigruppo per i predicati su `Point`
 */ import { pipe , Predicate , getSemigroup } from 'fp-ts/function' ; import { Semigroup } from 'fp-ts/Semigroup' ; import * as B from 'fp-ts/boolean' ; type Point = { readonly x : number ; readonly y : number ; } ; const isPositiveX = ( p ) => p . x >= 0 ; const isPositiveY = ( p ) => p . y >= 0 ; const S = getSemigroup ( B . SemigroupAll ) < Point > ( ) ; import * as assert from 'assert' ; const isPositiveXY = S . concat ( isPositiveX , isPositiveY ) ; assert . deepStrictEqual ( isPositiveXY ( { x : 1 , y : 1 } ) , true ) ; assert . deepStrictEqual ( isPositiveXY ( { x : 1 , y : - 1 } ) , false ) ; assert . deepStrictEqual ( isPositiveXY ( { x : - 1 , y : 1 } ) , false ) ; assert . deepStrictEqual ( isPositiveXY ( { x : - 1 , y : - 1 } ) , false ) ;