import Data.List import Data.Function import Data.Ord main :: IO () main = do putStrLn "hello" data Comparison s = forall a. Ord a => Comparison (s -> a) myList :: [Comparison String] myList = [ Comparison $ \str -> 2 , Comparison $ \str -> "hello: " <> str ] sortC :: Comparison a -> [a] -> [a] sortC (Comparison f) xs = sortBy (comparing f) xs myFunction :: [String] -> [String] myFunction xs = sortC (myList !! 0) xs