since import { These , left , right , both } from 'fp-ts/lib/These' ; import { array , URI } from 'fp-ts/lib/Array' ; import { Option , option } from 'fp-ts/lib/Option' ; import { identity , tuple } from 'fp-ts/lib/function' ; import { Align1 , padZipWith } from './' ; since export const alignArray = { URI , map : array . map , /**
     * Unit value in regards to `align`
     */ nil : < A > ( ) : Array < A > => [ ] , example since alignWith : < A , B , C > ( fa , fb , f ) : Array < C > => { const fc = [ ] ; const aLen = fa . length ; const bLen = fb . length ; const len = Math . min ( aLen , bLen ) ; for ( let i = 0 ; i < len ; i ++ ) { fc [ i ] = f ( both ( fa [ i ] , fb [ i ] ) ) ; } if ( aLen > bLen ) { for ( let i = bLen ; i < aLen ; i ++ ) { fc [ i ] = f ( left ( fa [ i ] ) ) ; } } else { for ( let i = aLen ; i < bLen ; i ++ ) { fc [ i ] = f ( right ( fb [ i ] ) ) ; } } return fc ; } , example since align : < A , B > ( fa , fb ) : Array < These < A , B > > => { return alignArray . alignWith < A , B , These < A , B > > ( fa , fb , identity ) ; } } ; example since export const lpadZipWith = ( xs , ys , f ) => array . compact ( padZipWith ( alignArray ) ( xs , ys , ( ma , mb ) => option . map ( mb , ( b ) => f ( ma , b ) ) ) ) ; example since export const lpadZip = ( xs , ys ) => lpadZipWith ( xs , ys , ( a , b ) => tuple ( a , b ) ) ; example since export const rpadZipWith = ( xs , ys , f ) => lpadZipWith ( ys , xs , ( a , b ) => f ( b , a ) ) ; example since export const rpadZip = ( xs , ys ) => rpadZipWith ( xs , ys , ( a , b ) => tuple ( a , b ) ) ;