My prof asked us to implement bubble sort in Haskell. The problem should be easy, however, he specified the function signature like this
bsort :: (a -> a -> Bool) -> [a] -> [a]
bsort = undefined
The problem is that a is not deriving Ord
, so I have no idea how to compare a
s. So I wonder if this is doable or he forgot to add (Ord a) =>
?
CodePudding user response:
Yes, it is doable, no he did not forget. Here's a hint:
bsort (<=) = undefined