Functional Design Patterns for General Purpose & GPU Programming