HackerTrans
TopNewTrendsCommentsPastAskShowJobs

jffaufwwasd

no profile record

comments

jffaufwwasd
·السنة الماضية·discuss
This is where you should be combining them.

Ok' and Err' as nominal type constructors which are unioned:

    struct Ok<T>(T);
    struct Err<E>(E);

    fn parse_error(input_string: &str) -> Ok Error | Err (ErrorA | ErrorB | ErrorC...)
Or make a sum type

    enum Result<T, E>  {
        Ok(T),
        Err(E),
    }

    fn parse_error(input_string: &str) -> Result<Error, (ErrorA | ErrorB | ErrorC...)>
The error types are unioned for easy composition but you have a top level sum type to differentiate between success and failure.