type check for foldr1, foldl