-
-
Notifications
You must be signed in to change notification settings - Fork 149
Closed
Description
The problem
It's a bit too verbose to write Style.(array([| style1, style2 |]))
. This solution is nice, especially for zero-cost, but I have found something useful that might be added here.
Considered solution
Tuples are encoded as array by bucklescript. We could leverage this by adding methods similar to this:
external _2: (('a, 'a)) => 'a = "%identity";
external _3: (('a, 'a, 'a)) => 'a = "%identity";
external _4: (('a, 'a, 'a, 'a)) => 'a = "%identity";
external _5: (('a, 'a, 'a, 'a)) => 'a = "%identity";
external _6: (('a, 'a, 'a, 'a, 'a)) => 'a = "%identity";
external _2options: ((option('a), option('a))) => 'a = "%identity";
external _3options: ((option('a), option('a), option('a))) => 'a = "%identity";
external _4options: ((option('a), option('a), option('a), option('a))) => 'a = "%identity";
external _5options: ((option('a), option('a), option('a), option('a))) => 'a = "%identity";
external _6options: ((option('a), option('a), option('a), option('a), option('a))) => 'a = "%identity";
This might help to replace
Style.array([| style1, style2 |])
by
Style._2(style1, style2)
Open to ideas for the naming. I would like to something short since it's the purpose of this new methods :D
Alternatives solutions
More Ideas?
Metadata
Metadata
Assignees
Labels
No labels