Learn You a Haskell shows the insert function.insert takes an element and a list of elements that can be sorted and  inserts it into the last position where it's still less than or equal  to the next element. In other words, insert will start at the  beginning of the list and then keep going until it finds an element  that's equal to or greater than the element that we're inserting and  it will insert it just before the element.ghci> insert 4 [3,5,1,2,8,2]  [3,4,5,1,2,8,2]  ghci> insert 4 [1,3,4,4,1]  [1,3,4,4,4,1] How's my implementation?insert' :: (Ord a) => a -> [a] -> [a]insert' x []     = [x]insert' x yys@(y:ys) = if x <= y then x : yys else y : insert' x ys
Implementing Haskell's `insert`
haskell;reinventing the wheel