implement generic functions for Pipe (#32)