Skip to content

Commit e51d169

Browse files
authored
Fix covariant result error (#238)
* Fix sorting of exports * Make result error covariant
1 parent cb6bfcc commit e51d169

File tree

20 files changed

+122
-110
lines changed

20 files changed

+122
-110
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ repos:
1414
language: node
1515
pass_filenames: false
1616
types: [python]
17-
additional_dependencies: ["[email protected].391"]
17+
additional_dependencies: ["[email protected].394"]
1818
repo: local

expression/__init__.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@
6565
__all__ = [
6666
"AsyncReplyChannel",
6767
"Builder",
68+
"EffectError",
69+
"Error",
70+
"Failure",
71+
"MailboxProcessor",
72+
"Nothing",
73+
"Ok",
74+
"Option",
75+
"Result",
76+
"Some",
77+
"Success",
78+
"TailCall",
79+
"TailCallResult",
80+
"Try",
81+
"__version__",
6882
"case",
6983
"collections",
7084
"compose",
@@ -75,9 +89,6 @@
7589
"default_arg",
7690
"downcast",
7791
"effect",
78-
"EffectError",
79-
"Error",
80-
"Failure",
8192
"failwith",
8293
"flip",
8394
"fst",
@@ -86,27 +97,16 @@
8697
"is_none",
8798
"is_ok",
8899
"is_some",
89-
"MailboxProcessor",
90-
"Nothing",
91-
"Ok",
92100
"option",
93-
"Option",
94101
"pipe",
95102
"pipe2",
96103
"pipe3",
97104
"result",
98-
"Result",
99105
"snd",
100-
"Some",
101-
"Success",
106+
"tag",
102107
"tagged_union",
103-
"TailCall",
104-
"TailCallResult",
105108
"tailrec",
106109
"tailrec_async",
107-
"Try",
108-
"tag",
109110
"try_downcast",
110111
"upcast",
111-
"__version__",
112112
]

expression/collections/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99

1010
__all__ = [
11+
"Block",
12+
"Map",
13+
"Seq",
14+
"TypedArray",
1115
"array",
1216
"asyncseq",
13-
"Block",
1417
"block",
15-
"Map",
1618
"map",
17-
"Seq",
1819
"seq",
19-
"TypedArray",
2020
]

expression/collections/array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,22 +656,22 @@ def unfold(state: _TState, generator: Callable[[_TState], Option[tuple[_TSource,
656656

657657

658658
__all__ = [
659+
"TypedArray",
659660
"empty",
660661
"filter",
661662
"fold",
662663
"indexed",
663664
"is_empty",
664665
"item",
665666
"map",
667+
"of",
666668
"of_option",
667669
"of_seq",
668-
"of",
670+
"singleton",
669671
"sum",
670672
"sum_by",
671-
"singleton",
672673
"take",
673674
"take_last",
674675
"try_head",
675-
"TypedArray",
676676
"unfold",
677677
]

expression/collections/asyncseq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ async def _map(source: AsyncIterable[TSource]) -> AsyncIterable[TResult]:
9999

100100
__all__ = [
101101
"AsyncSeq",
102-
"range",
103102
"filter",
104103
"map",
104+
"range",
105105
"repeat",
106106
]

expression/collections/block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,12 +1048,12 @@ def zip(
10481048
"fold",
10491049
"head",
10501050
"indexed",
1051-
"item",
10521051
"is_empty",
1052+
"item",
10531053
"map",
10541054
"mapi",
1055-
"of_seq",
10561055
"of_option",
1056+
"of_seq",
10571057
"partition",
10581058
"singleton",
10591059
"skip",

expression/collections/map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,9 @@ def try_find(table: Map[_Key, _Value], key: _Key) -> Option[_Value]:
494494
"Map",
495495
"add",
496496
"change",
497-
"create",
498497
"contains_key",
499498
"count",
499+
"create",
500500
"empty",
501501
"exists",
502502
"filter",

expression/collections/seq.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,8 @@ def _zip(source2: Iterable[_TResult]) -> Iterable[tuple[_TSource, _TResult]]:
977977
"Seq",
978978
"append",
979979
"choose",
980-
"concat",
981980
"collect",
981+
"concat",
982982
"delay",
983983
"empty",
984984
"filter",
@@ -992,12 +992,12 @@ def _zip(source2: Iterable[_TResult]) -> Iterable[tuple[_TSource, _TResult]]:
992992
"min",
993993
"min_by",
994994
"of",
995-
"of_list",
996995
"of_iterable",
996+
"of_list",
997997
"range",
998998
"scan",
999-
"skip",
1000999
"singleton",
1000+
"skip",
10011001
"sum",
10021002
"sum_by",
10031003
"tail",

expression/core/__init__.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,33 @@
2525

2626

2727
__all__ = [
28-
"aiotools",
2928
"AsyncReplyChannel",
3029
"Builder",
30+
"EffectError",
31+
"Error",
32+
"Failure",
33+
"MailboxProcessor",
34+
"Nothing",
35+
"Ok",
36+
"Option",
37+
"PipeMixin",
38+
"Result",
39+
"Some",
40+
"Success",
41+
"SupportsGreaterThan",
42+
"SupportsLessThan",
43+
"SupportsMatch",
44+
"SupportsSum",
45+
"TailCall",
46+
"TailCallResult",
47+
"Try",
48+
"aiotools",
49+
"case",
3150
"compose",
3251
"curry",
3352
"curry_flip",
3453
"default_arg",
3554
"downcast",
36-
"EffectError",
37-
"Error",
38-
"Failure",
3955
"failwith",
4056
"flip",
4157
"fst",
@@ -44,33 +60,17 @@
4460
"is_none",
4561
"is_ok",
4662
"is_some",
47-
"MailboxProcessor",
48-
"Nothing",
49-
"Ok",
50-
"Option",
5163
"option",
5264
"pipe",
5365
"pipe2",
5466
"pipe3",
55-
"PipeMixin",
5667
"result",
57-
"Result",
58-
"tagged_union",
5968
"snd",
60-
"Some",
61-
"Success",
62-
"SupportsLessThan",
63-
"SupportsGreaterThan",
64-
"SupportsMatch",
65-
"SupportsSum",
6669
"tag",
67-
"case",
68-
"TailCall",
69-
"TailCallResult",
70+
"tag",
71+
"tagged_union",
7072
"tailrec",
7173
"tailrec_async",
72-
"Try",
73-
"tag",
7474
"try_downcast",
7575
"upcast",
7676
]

expression/core/aiotools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ async def from_result(result: _TSource) -> _TSource:
164164
"Continuation",
165165
"empty",
166166
"from_continuations",
167+
"run_synchronously",
167168
"singleton",
168169
"sleep",
169170
"start",
170171
"start_immediate",
171-
"run_synchronously",
172172
]

expression/core/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ def fst(value: tuple[_TSource, Any]) -> _TSource:
4848
return a
4949

5050

51-
__all__ = ["fst", "identity", "starid", "flip", "snd"]
51+
__all__ = ["flip", "fst", "identity", "snd", "starid"]

expression/core/option.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -528,24 +528,24 @@ def default_arg(value: Option[_TSource], default_value: _T1) -> _TSource | _T1:
528528

529529

530530
__all__ = [
531+
"Nothing",
531532
"Option",
532533
"Some",
533-
"Nothing",
534534
"bind",
535535
"default_arg",
536536
"default_value",
537537
"default_with",
538-
"map",
539-
"map2",
540538
"is_none",
541539
"is_some",
540+
"map",
541+
"map2",
542+
"model_dump",
543+
"of_obj",
544+
"of_optional",
545+
"of_result",
542546
"or_else",
543547
"to_list",
544-
"model_dump",
545-
"to_seq",
546548
"to_optional",
547-
"of_optional",
548549
"to_result",
549-
"of_result",
550-
"of_obj",
550+
"to_seq",
551551
]

expression/core/pipe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,4 +316,4 @@ def pipe(self, *args: Any) -> Any:
316316
return pipe(self, *args)
317317

318318

319-
__all__ = ["pipe", "pipe2", "pipe3", "PipeMixin", "starpipe"]
319+
__all__ = ["PipeMixin", "pipe", "pipe2", "pipe3", "starpipe"]

0 commit comments

Comments
 (0)