Going through the magnificent Haskell Programming from first principles, I’m currently reimplementing functions from standard libraries such as
Here are my current versions of them:
myMaximumBy :: (a -> a -> Ordering) -> [a] -> a -- maximumBy in Data.List also throws an error on empty lists myMaximumBy _  = error "empty list" myMaximumBy f (x:xs) = go xs x where go  curMax = curMax go (h:t) curMax = go t $ if (f h curMax) == GT then h else curMax -- Could be shorter, but less readable with bool from Data.Bool: -- go (h:t) curMax = go t $ bool curMax h (f h curMax == GT) myMinimumBy :: (a -> a -> Ordering) -> [a] -> a myMinimumBy f = myMaximumBy $ \x y -> negateOrdering $ f x y where negateOrdering EQ = EQ negateOrdering LT = GT negateOrdering GT = LT
I know they’re not total functions, but I’ll get to rewriting them with something like
Maybe later on.
What I’m more curious about is whether it’s a problem to define
negateOrdering; could this be a problem for some implementations of the ordering function
Additionaly to takes on the question in the last paragraph, I’m happy for any kind of feedback on how to make the code shorter, more readable, or more idiomatic.
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!