summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/scripts/T17431.hs
blob: 78050576df0b2ca7072c84e0e5db22cf83235db1 (plain)
1
2
3
4
5
6
7
8
9
10
module T17431 (sort) where

sort :: Ord a => [a] -> [a]
sort [] = []
sort (x:xs) = insert x (sort xs)

insert :: Ord a => a -> [a] -> [a]
insert x [] = [x]
insert x (y:ys) | x < y     = x:y:ys
                | otherwise = y:(insert x ys)