export function id < A > ( a ) { return a ; } export function apply < A , B > ( f , a ) { return f ( a ) ; } export function mixin ( derivedCtor , baseCtors ) { baseCtors . forEach ( baseCtor => { Object . getOwnPropertyNames ( baseCtor . prototype ) . forEach ( name => { if ( ! ( name in derivedCtor ) && ! ( name in derivedCtor . prototype ) ) { derivedCtor . prototype [ name ] = baseCtor . prototype [ name ] ; } } ) ; } ) ; } export function add ( n , m ) { return n + m ; } export function compose < A , B , C > ( f , g ) { return ( a ) => f ( g ( a ) ) ; } export function impurePush < A > ( arr , a ) { arr . push ( a ) ; return arr ; } export function cons < A > ( a , as ) { return [ a ] . concat ( as ) ; } export function curry3 < A , B , C , R > ( f ) { return a => b => c => f ( a , b , c ) ; } export function curry2 < A , B , R > ( f ) { return a => b => f ( a , b ) ; } export function flip < A , B , C > ( f ) { return ( b , a ) => f ( a , b ) ; } export function foldlArray < A , B > ( f , init , a ) { for ( let i = 0 ; i < a . length ; ++ i ) { init = f ( init , a [ i ] ) ; } return init ; } export function foldlArray1 < A > ( f , a ) { let init = a [ 0 ] ; for ( let i = 1 ; i < a . length ; ++ i ) { init = f ( init , a [ i ] ) ; } return init ; } export function arrayFlatten < A > ( m ) { let result = [ ] ; for ( let i = 0 ; i < m . length ; ++ i ) { for ( let j = 0 ; j < m [ i ] . length ; ++ j ) { result . push ( m [ i ] [ j ] ) ; } } return result ; } export function deepEqual ( a , b ) { if ( typeof a === "object" && typeof b === "object" ) { const aKeys = Object . keys ( a ) ; for ( const key of aKeys ) { if ( ! deepEqual ( a [ key ] , b [ key ] ) ) { return false ; } } return true ; } else { return a === b ; } } export type F0 < Z > = ( ) => Z ; export type F1 < A , Z > = ( a : A ) => Z ; export type F2 < A , B , Z > = ( a : A , b : B ) => Z ; export type F3 < A , B , C , Z > = ( a : A , b : B , c : C ) => Z ; export type F4 < A , B , C , D , Z > = ( a : A , b : B , c : C , d : D ) => Z ; export type F5 < A , B , C , D , E , Z > = ( a : A , b : B , c : C , d : D , e : E ) => Z ;