since import { Option , some , none , option , URI , isSome , isNone } from 'fp-ts/lib/Option' ; import { These , left , right , both } from 'fp-ts/lib/These' ; import { identity } from 'fp-ts/lib/function' ; import { Align1 } from './' ; since export const alignOption = { URI , map : option . map , since nil : < A > ( ) : Option < A > => none , example since alignWith : < A , B , C > ( fa , fb , f ) : Option < C > => { if ( isSome ( fa ) && isSome ( fb ) ) { return some ( f ( both ( fa . value , fb . value ) ) ) ; } else if ( isNone ( fa ) && isSome ( fb ) ) { return some ( f ( right ( fb . value ) ) ) ; } else if ( isSome ( fa ) && isNone ( fb ) ) { return some ( f ( left ( fa . value ) ) ) ; } else { return none ; } } , example since align : < A , B > ( fa , fb ) : Option < These < A , B > > => alignOption . alignWith ( fa , fb , identity ) } ;