import Data.Listimport Data.Function isEven x = x `mod` 2 == 0 main = print $ sortBy (compare `on` isEven) [1..4]
Standard input is empty
[1,3,2,4]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!