In my lecture, we had to define the function in figure 1 with foldr. The answer was
squareOn :: (Eq a, Num a) => [a] -> a -> a squareOn = foldr