-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
The new style formats this about 200x faster than the old one. It's still kind of slow, but tolerable. Fix #1521.
- Loading branch information
1 parent
e12c007
commit 47bcc07
Showing
4 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
typedef Map1<T1, R> = R Function(T1 arg1); | ||
|
||
typedef Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> = | ||
R Function( | ||
T1 arg1, | ||
T2 arg2, | ||
T3 arg3, | ||
T4 arg4, | ||
T5 arg5, | ||
T6 arg6, | ||
T7 arg7, | ||
T8 arg8, | ||
); | ||
|
||
extension Curry8<T1, T2, T3, T4, T5, T6, T7, T8, R> | ||
on Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> { | ||
Map1< | ||
T1, | ||
Map1<T2, Map1<T3, Map1<T4, Map1<T5, Map1<T6, Map1<T7, Map1<T8, R>>>>>>> | ||
> | ||
get curry => | ||
(T1 arg1) => | ||
(T2 arg2) => | ||
(T3 arg3) => | ||
(T4 arg4) => | ||
(T5 arg5) => | ||
(T6 arg6) => | ||
(T7 arg7) => | ||
(T8 arg8) => this( | ||
arg1, | ||
arg2, | ||
arg3, | ||
arg4, | ||
arg5, | ||
arg6, | ||
arg7, | ||
arg8, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
typedef Map1<T1, R> = R Function(T1 arg1); | ||
|
||
typedef Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> = R Function( | ||
T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); | ||
|
||
extension Curry8<T1, T2, T3, T4, T5, T6, T7, T8, R> | ||
on Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> { | ||
Map1< | ||
T1, | ||
Map1<T2, | ||
Map1<T3, Map1<T4, Map1<T5, Map1<T6, Map1<T7, Map1<T8, R>>>>>>>> | ||
get curry => (T1 arg1) => (T2 arg2) => (T3 arg3) => (T4 arg4) => | ||
(T5 arg5) => (T6 arg6) => (T7 arg7) => | ||
(T8 arg8) => this(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
typedef Map1<T1, R> = R Function(T1 arg1); | ||
|
||
typedef Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> = R Function( | ||
T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); | ||
|
||
extension Curry8<T1, T2, T3, T4, T5, T6, T7, T8, R> | ||
on Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> { | ||
Map1< | ||
T1, | ||
Map1<T2, | ||
Map1<T3, Map1<T4, Map1<T5, Map1<T6, Map1<T7, Map1<T8, R>>>>>>>> | ||
get curry => (T1 arg1) => (T2 arg2) => (T3 arg3) => (T4 arg4) => | ||
(T5 arg5) => (T6 arg6) => (T7 arg7) => | ||
(T8 arg8) => this(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
>>> | ||
typedef Map1<T1, R> = R Function(T1 arg1); | ||
|
||
typedef Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> = R Function( | ||
T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); | ||
|
||
extension Curry8<T1, T2, T3, T4, T5, T6, T7, T8, R> | ||
on Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> { | ||
Map1< | ||
T1, | ||
Map1<T2, | ||
Map1<T3, Map1<T4, Map1<T5, Map1<T6, Map1<T7, Map1<T8, R>>>>>>>> | ||
get curry => (T1 arg1) => (T2 arg2) => (T3 arg3) => (T4 arg4) => | ||
(T5 arg5) => (T6 arg6) => (T7 arg7) => | ||
(T8 arg8) => this(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); | ||
} | ||
<<< | ||
typedef Map1<T1, R> = R Function(T1 arg1); | ||
|
||
typedef Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> = | ||
R Function( | ||
T1 arg1, | ||
T2 arg2, | ||
T3 arg3, | ||
T4 arg4, | ||
T5 arg5, | ||
T6 arg6, | ||
T7 arg7, | ||
T8 arg8, | ||
); | ||
|
||
extension Curry8<T1, T2, T3, T4, T5, T6, T7, T8, R> | ||
on Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> { | ||
Map1< | ||
T1, | ||
Map1<T2, Map1<T3, Map1<T4, Map1<T5, Map1<T6, Map1<T7, Map1<T8, R>>>>>>> | ||
> | ||
get curry => | ||
(T1 arg1) => | ||
(T2 arg2) => | ||
(T3 arg3) => | ||
(T4 arg4) => | ||
(T5 arg5) => | ||
(T6 arg6) => | ||
(T7 arg7) => | ||
(T8 arg8) => this( | ||
arg1, | ||
arg2, | ||
arg3, | ||
arg4, | ||
arg5, | ||
arg6, | ||
arg7, | ||
arg8, | ||
); | ||
} |