Comment

Comment by Mond_

> The second approach is open for extension - it allows you to write new functions on old datatypes.

I prefer to just generalize the function (make it generic, leverage traits/typeclasses) tbh.

> Probably for lack of > weird operators like <$>, <*>, $, or >>=

Nope btw. I mean, maybe? I don't know Haskell well enough to say. The answer that I was looking for here is a specific Rust idiosyncrasy. It doesn't allow you to import `std::iter::Iterator::collect` on its own. It's an associated function, and needs to be qualified. (So you need to write `Iterator::collect` at the very least.)

parent Mond_ 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton