Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In C++:

    template<template<class> class Container, class T, invocable<T> Fn>
    Container<invoke_result_t<Fn, T> > map(Container<T> container, Fn fn) {
      return to<Container>(transform(container,  fn));
    }
(Although idiomatically you wouldn't write the code this way).

Whether that counts as HK types, I'll leave it to others to discuss.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: