export type Maybe < T > = T | undefined ; export type MaybeNull < T > = Maybe < T > | null ; export function map < T , U > ( maybeT , f ) { return maybeT == null ? undefined : f ( maybeT ) ; } export function first < T , U > ( iter , f ) { for ( const t of iter ) { if ( t != null ) { const v = f ( t ) ; if ( v != null ) return v ; } } return ; } export function firstDefinedThunk < T > ( iter ) { for ( const f of iter ) { const result = f ( ) ; if ( result != null ) return result ; } return ; } /**
 * Convert functions that return `type | null` to `type | undefined`
 */ export function denull < T > ( t ) { return t == null ? undefined : t ; }