Solution (source code)

= Solution

Preserve absence and transform only a present value:
``
map' :: (a -> b) -> List a -> List b
map' g (List f) = List (\i -> case f i of
                              Nothing -> Nothing
                              Just x  -> Just (g x))
``
Every query keeps its presence status, so the represented length and the no-holes <invariant> are unchanged. The transformed element is computed only when demanded.