I have the following function that sholud return only odd numbers from the List
oddsOnly :: Integral a => [a] -> [a]
oddsOnly [] = []
oddsOnly (x:xs)
|odd x = x : oddsOnly xs
|otherwise = oddsOnly xs
My question is about the aim of using
Integral a =>
Actually it is not posssible to implement such function with such type declaration
oddsOnly :: [a] -> [a]
As far as I know even and odd functions are in standart Prelude library so why simplified daclaration does not work?
Thanks in advance