Type constraints for automatic function constraint deduction in Haskell
问题 For educational purposes I am playing around with trees in Haskell. I have Tree a type defined like this data Tree a = EmptyTree | Node a (Tree a) (Tree a) and a lot of functions that share a basic constraint - Ord a - so they have types like treeInsert :: Ord a => a -> Tree a -> Tree a treeMake :: Ord a => [a] -> Tree a and so on. I can also define Tree a like this data Ord a => Tree a = EmptyTree | Node a (Tree a) (Tree a) but I can not simplify my functions and omit the extra Ord a to be