3 ms·
Minor clarification that doesn't pertain to the general premise of the article: > However, if we want to use it on user-defined types, we'll need to implement
by elihu 9y ago
Minor clarification that doesn't pertain to the general premise of the article:
> However, if we want to use it on user-defined types, we'll need to implement the Ord class manually:
For user-defined types, you can usually add "deriving Ord" to the definition, and the compiler creates a default implementation for you. You might want to implement it manually if the specifics of how it works are important to the application or if the type contains a field that GHC can't automatically derive Ord for (like a function).
Usually, for most types I use "deriving (Eq, Ord, Show)" unless I have a good reason not to.