Hacker News new | ask | show | jobs
by tome 4131 days ago
> generic code is definitely more complicated

In Haskell at least this is usually not correct. A sorting algorithm with type

    Ord a => [a] -> [a]
(i.e. a generic one) is likely to be more neatly implemented than one of type

    [Int] -> [Int]
because the former can't use irrelevant properties of the type of the values contained in the list.

Perhaps you meant something different by "generic" though. There are a few subtly different uses of that word. One of them means a very neat and powerful generality as seen is Haskell's parametric polymophism. Another is a convoluted run-time tag-based dispatch mechanism which is often under-specified. I can imagine that programmers who have only ever seen "generic" code in the Python object oriented style (to take one example) think this style of "generic" code is more messy than "specific" code.