since import { HKT , Kind , Kind2 , Kind3 , URIS , URIS2 , URIS3 } from 'fp-ts/lib/HKT' ; import { Semigroup } from 'fp-ts/lib/Semigroup' ; import { identity , tuple } from 'fp-ts/lib/function' ; import { Option , some , none } from 'fp-ts/lib/Option' ; import { Semialign , Semialign1 , Semialign2 , Semialign2C , Semialign3 } from '../Semialign' ; import { fold , bimap } from 'fp-ts/lib/These' ; import { pipe } from 'fp-ts/lib/pipeable' ; since export interface Align < F > extends Semialign < F > { readonly nil : < A > ( ) => HKT < F , A > ; } since export interface Align1 < F extends URIS > extends Semialign1 < F > { readonly nil : < A > ( ) => Kind < F , A > ; } since export interface Align2 < F extends URIS2 > extends Semialign2 < F > { readonly nil : < L , A > ( ) => Kind2 < F , L , A > ; } since export interface Align2C < F extends URIS2 , L > extends Semialign2C < F , L > { readonly nil : < A > ( ) => Kind2 < F , L , A > ; } since export interface Align3 < F extends URIS3 > extends Semialign3 < F > { readonly nil : < U , L , A > ( ) => Kind3 < F , U , L , A > ; } example since export function salign < F extends URIS3 , A , L > ( F , S ) ; export function salign < F extends URIS2 , A > ( F , S ) ; export function salign < F extends URIS2 , A , L > ( F , S ) ; export function salign < F extends URIS , A > ( F , S ) ; export function salign < F , A > ( F , S ) ; export function salign < F , A > ( F , S ) { return ( fx , fy ) => F . alignWith ( fx , fy , fold ( identity , identity , S . concat ) ) ; } example since export function padZip < F extends URIS3 , L > ( F ) ; export function padZip < F extends URIS2 > ( F ) ; export function padZip < F extends URIS2 , L > ( F ) ; export function padZip < F extends URIS > ( F ) ; export function padZip < F > ( F ) ; export function padZip < F > ( F ) { return ( fa , fb ) => padZipWith ( F ) ( fa , fb , ( a , b ) => tuple ( a , b ) ) ; } example since export function padZipWith < F extends URIS3 , L > ( F ) ; export function padZipWith < F extends URIS2 > ( F ) ; export function padZipWith < F extends URIS2 , L > ( F ) ; export function padZipWith < F extends URIS > ( F ) ; export function padZipWith < F > ( F ) ; export function padZipWith < F > ( F ) { return ( fa , fb , f ) => F . alignWith ( fa , fb , ( ab ) => pipe ( ab , bimap ( some , some ) , fold ( ( a ) => f ( a , none ) , ( b ) => f ( none , b ) , ( a , b ) => f ( a , b ) ) ) ) ; }