replace Either/Result by custom type(s)