|
|
|
|
|
by masfuerte
301 days ago
|
|
I think I'm missing something. Presumably, you use a function like this to represent your sum type containing the value "avalue": (readA, readB) => readA(avalue)
The problem I have is that when you create this function you have to reify the return type Z. You can't use this value in arbitrary contexts where the accessors need to return different types.How do you get this to work? |
|
I mean you could return a sum type if you really need to.
Formally a sum type is just something that turns a pair of functions to Z into a single function from the sum type to Z. In fact it shouldn't do more than that.