import Data.List import Data.Function main :: IO () main = do putStrLn "hello" myList :: forall a. Ord a => [String -> a] myList = [ \str -> 2 , \str -> "hello: " <> str ] sortWithBy :: (a -> b) -> (b -> b -> Ordering) -> [a] -> [a] sortWithBy f comp = sortBy (comp `on` f) myFunction :: [String] -> [String] myFunction xs = sortWithBy (myList !! 0) compare xs