I understand that omitting typeclasses from Elm was intentional and agree that it vastly simplifies the resulting code. However, sometime I am annoyed by things like this:
Every module seems to export its own
map function! Coming from Haskell, I see this as completely excessive compared to Haskell’s generic
This really bothers me because it’s such an integral part of functional programming and it’s handled so (IMO) badly.
Of course, the Elm compiler could add another “magic type variable” (which I think are more confusing than type constraints, and less versatile) for functors… but why do that when they could allow us to add our own type variables.
The arguments against type constraints seem to mostly appeal to simplicity, but that seems pretty fickle to me. Who can honestly argue that tens of
map implementations is simpler than one
fmap that just works?
Anyway, I’m curious mainly why people in the community are against (or for) type constraints. Don’t get me wrong—I don’t want to make Elm into Haskell. However, this fixture of functional programming (from my viewpoint) being completely absent shocked me when I was first learning Elm, so I’m wondering why the decision was made to not include it.