listSet :: [a] -> Int -> a -> a -> [a]
listSet as i defaultA a 
  | i < length as = take i as ++ [a] ++ drop (i+1) as
  | otherwise = listSet (as ++ replicate (i + 1 - length as) defaultA) i defaultA a
listSet :: [a] -> Int -> a -> a -> [a]
listSet as i defaultA a 
  | i < length as = take i as ++ [a] ++ drop (i+1) as
  | otherwise = listSet (as ++ replicate (i + 1 - length as) defaultA) i defaultA a
listSet as i defaultA a 
  | i < length as = take i as ++ [a] ++ drop (i+1) as
  | otherwise = listSet (as ++ replicate (i + 1 - length as) defaultA) i defaultA a