| ▲ | mrkeen 5 hours ago | |
No. The parser code (in a library that everyone depends on) will branch on success/fail internally. It has nothing to branch on if it only sees T, because T may not have a success/fail nature. You could take a step back and make sure T has a fail case, e.g. T-extends-Either<A, B>, but what is to be gained? * Firstly, what the hell is A? * The user would need to type Parsers of T=Cat and T=Dog instead as Parsers of T=Either<Error,Dog> and T=Either<Error,Cat>. If everyone has to do it, pull the common abstraction back into the library itself! Also the caller would receive a successful parse of T=Either and would then need to check to see if it was success(success) or success(fail). * You also mix abstractions in the same way as newlines in string literals. You could no longer represent a successful parse of a failed Either, since the failed Either would look like a parse error. | ||
| ▲ | an hour ago | parent [-] | |
| [deleted] | ||