Use failover and ix:
failover
ix
bar :: Maybe (HashMap String Integer) bar = failover (ix "1") (\_ -> 2) foo