0
comment
comment
on 10/8/2012 8:04 AM
Discriminated unions or sum types are a natural way to model logical OR. Often you have a property that distributes over OR. Say, in F# (used throughout the article, though the ideas should apply equally well to any ML), you can write a combinator of the type:
P<'T1> → P<'T2> → P<Choice<'T1,'T2>>
How to go from here to a nice set of combinators that would handle an arbitrary union? This question has been on my mind for a while, and finally I have an acceptable solution.
As a disclaimer, at the level of [...]