Why is there no typeclass for container-types?

haskell

Solution

Actually there are, see question Making a single function work on lists, ByteStrings and Texts (and perhaps other similar representations), which is almost a duplicate of yours.

The main reason for being in a separate package is probably that it needs a language extension - either functional dependencies or type families. We have to somehow say that `Text` can contain only `Char`s, `ByteString` can contain only `Word8`s, `[]` can contain any type, and `Set` can contain only instances of `Ord`.

Problem

I found out that some containers have a very similar function set. List, Set, Sequence, Text and Bytestrings for example. I wonder why they don't use one or more common typeclasses.

Original source

Related problems