Hacker News new | ask | show | jobs
by kccqzy 17 days ago
Your brain crashes just because of unfamiliarity with the syntax. Just mentally translate it into C++ or Rust syntax.

    template<typename A, typename B, typename C, typename D, typename E>
    std::variant<std::string, std::tuple<B, C, std::vector<D>, E> processRecord(std::function_ref<B(A const&)>, std::optional<C> const&, std::span<D>, std::function_ref<bool(E const&)>, std::tuple<B, C, std::vector<D>, E>);
This familiarity can be gained in frankly a day or two of trying, and afterwards you’ll find it to be clear and information dense. The example doesn’t even involve anything truly mind blowing for a beginner yet, like the Traversable class, the lens/traversal/prism signatures, or polymorphic recursion.
1 comments

See how much more readable that is? /s
You can typedef your way to readability in C++.
Similarly you can type definition (`data` keyword) your way to additional readability in Haskell. There's always a push/pull between using a generic type like `(b, c, [d], e)` and using a named type like `Record` in the above example, for instance.