typed out Brent Yorgey's powerset implementation.