-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
In place of traditional sum and product types, the plan is to only support polymorphic records and variants. The records are already in place, so that just leaves the variants.
In order to support variant elimination, we need a way to handle the cases. This could be done w/ if or switch statements, but I'd like to use babel/babel#7633 if it's not too much work.
Variant types would be declared as follow (via the Flow type AST):
type Either<l,r> = {Left: l} | {Right: r};
let
either: <l,r,a>(l => a) => (r => a) => Either<l,r> => a;
either = f => g => e => match(e) {
({Left: l}) => f(l),
({Right: r}) => g(r)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels