let map_err f r = match r with | (`Ok _ as r) -> r | `Error e -> `Error (f e)