import { Arity1 , IO } from './types' ; /** Left-to-right composition for exactly two function */ export const pipe2 = < A , B , C > ( f , g ) => ( x ) : C => g ( f ( x ) ) ; /**
 * Generic Left-to-right composition
 */ export const pipe = ( ( ... fns ) => fns . length > 1 ? fns . slice ( 1 ) . reduce ( pipe2 , fns [ 0 ] ) : fns [ 0 ] ) as Pipe ; export interface Pipe { < A > ( a ) : IO < A > ; < A , B > ( a , b ) : IO < B > ; < A , B , C > ( a , b , c ) : IO < C > ; < A , B , C , D > ( a , b , c , d ) : IO < D > ; < A , B , C , D , E > ( a , b , c , d , e ) : IO < E > ; < A , B , C , D , E , F > ( a , b , c , d , e , f ) : IO < F > ; < A , B > ( a ) : Arity1 < A , B > ; < A , B , C > ( a , b ) : Arity1 < A , C > ; < A , B , C , D > ( a , b , c ) : Arity1 < A , D > ; < A , B , C , D , E > ( a , b , c , d ) : Arity1 < A , E > ; < A , B , C , D , E , F > ( a , b , c , d , e ) : Arity1 < A , F > ; < A , B , C , D , E , F , G > ( a , b , c , d , e , f ) : Arity1 < A , G > ; < A , B , C , D , E , F , G , H > ( a , b , c , d , e , f , g ) : Arity1 < A , H > ; < A , B , C , D , E , F , G , H , I > ( a , b , c , d , e , f , g , h ) : Arity1 < A , I > ; < A , B , C , D , E , F , G , H , I , J > ( a , b , c , d , e , f , g , h , j ) : Arity1 < A , J > ; }