4 ms·
Well, yes and no. What you say also applies if two errors have the same type but you want to differentiate where it comes from. In all these cases you can wrap
by valenterry 3y ago
Well, yes and no. What you say also applies if two errors have the same type but you want to differentiate where it comes from. In all these cases you can wrap the result or error into something, which essentially means tagging it (but without actually needing sumtypes as a language concept.
Sumtypes sure are useful, but I believe that except for GADTs, you can emulate sumtypes with uniontypes, but not vice versa.