from the rowanblush solution
using Ordering monoid instance we can change the bias on EQ for all higher order accepting (a -> a -> Ordering)
module LeftBias where
import Data.Monoid
leftBias g = g . (fmap . fmap) (`mappend` GT)
import Data.List
import Data.Ord
import Test.Hspec
import LeftBias
main = hspec $ do
describe "leftBias with maximumBy" $ do
it "maximumBy is right biased" $
maximumBy (comparing length) ["ciao","wave"] `shouldBe` "wave"
it "leftBias maximumBy is left biased" $
leftBias maximumBy (comparing length) ["ciao","wave"] `shouldBe` "ciao"