Seq vs List: which should I choose?

For data types I almost always use List. If I know I’m going to be doing a lot of concatenation I’ll use cats.data.Chain. I find that I basically never need to do indexing, but if I did I would probably use Vector.

In method signatures where I just need something I can map over I’ll use F[_]: Functor; or if I need to combine the contents I’ll use F[_]: Foldable; or if I need to compute an effectful value over the elements I’ll use F[_]: Traverse, and so on (these abstractions are from Cats). I don’t find the superclass-based abstractions like Seq to be a meaningful enough to be useful.

1 Like