functional programming exercises https://inf.ug.edu.pl/~schwarzw/zadania/ZadHaskell-2013.html