Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
49f678f
first commit
eb8680 Jul 3, 2025
d99753b
format
eb8680 Jul 3, 2025
b4417f3
test passes
eb8680 Jul 3, 2025
02eb5ec
types
eb8680 Jul 3, 2025
8a5152d
add docstring with doctests for unify
eb8680 Jul 3, 2025
13877f2
more test cases
eb8680 Jul 3, 2025
0dbd307
case
eb8680 Jul 3, 2025
e675bf6
docstring and test cases for infer_return_type
eb8680 Jul 3, 2025
90dd9fb
canonicalize
eb8680 Jul 4, 2025
c95ea01
fixes
eb8680 Jul 4, 2025
4a1461f
fix error type
eb8680 Jul 4, 2025
a27d811
add _nested_type for sequences
eb8680 Jul 4, 2025
c5c09a3
make _nested_type singledispatch extensible
eb8680 Jul 4, 2025
ce12433
term case
eb8680 Jul 4, 2025
f2492af
nit
eb8680 Jul 4, 2025
0cb5516
docstrings and tests for canonicalize and nested_type
eb8680 Jul 4, 2025
87dd5c8
no notimmplentederror
eb8680 Jul 4, 2025
841fc49
variadic params
eb8680 Jul 4, 2025
c1d102a
remove dead code paths in unify
eb8680 Jul 4, 2025
25eaa57
simplify unify
eb8680 Jul 4, 2025
dfd3507
union
eb8680 Jul 4, 2025
6d67944
tweak
eb8680 Jul 4, 2025
652061c
cleanup
eb8680 Jul 4, 2025
c651639
fix none case
eb8680 Jul 7, 2025
a6f0188
more aggressive canonicalize applied only during unification
eb8680 Jul 7, 2025
e79b5d3
update canonicalize test
eb8680 Jul 8, 2025
ef34247
remove dead path
eb8680 Jul 8, 2025
748bcac
paramspec failure
eb8680 Jul 8, 2025
08d149f
literal and optional
eb8680 Jul 8, 2025
0efe01d
paramspec canonicalize
eb8680 Jul 8, 2025
b52c7df
simplify alias
eb8680 Jul 8, 2025
c5f0f1b
single unify call
eb8680 Jul 8, 2025
bd006b8
fast paths
eb8680 Jul 8, 2025
84e8734
union handling
eb8680 Jul 8, 2025
a6426ae
freshen
eb8680 Jul 8, 2025
3a8f726
type of freshen
eb8680 Jul 8, 2025
4639ce0
reorder
eb8680 Jul 8, 2025
ab7b1ff
fixpoint in substitute
eb8680 Jul 8, 2025
de9e7b6
tweak types
eb8680 Jul 8, 2025
9dc9acd
empty params
eb8680 Jul 8, 2025
7fd9927
tweak substitute type
eb8680 Jul 8, 2025
7330f23
doctest
eb8680 Jul 8, 2025
acf9f11
separate nested_type
eb8680 Jul 8, 2025
9ec83f8
handle defaults
eb8680 Jul 8, 2025
d7fc53b
update
eb8680 Jul 10, 2025
2a99670
remove test ids
eb8680 Jul 10, 2025
3e01b8c
add to sphinx
eb8680 Jul 10, 2025
13bbf74
fix doctests
eb8680 Jul 10, 2025
f655dce
fix type checking
eb8680 Jul 10, 2025
bc371ee
str
eb8680 Jul 10, 2025
2b5db42
lint and format
eb8680 Jul 10, 2025
2dddc92
freshen -> _freshen
eb8680 Jul 10, 2025
2199d63
factor out freetypevars and susbtitute
eb8680 Jul 10, 2025
c6fe3fc
truncate names
eb8680 Jul 10, 2025
97f4862
doctest
eb8680 Jul 10, 2025
23de369
doctest
eb8680 Jul 10, 2025
f8247da
add compositional tests
eb8680 Jul 10, 2025
e173387
add tests for function types
eb8680 Jul 10, 2025
6b532af
ellipsis and paramspec
eb8680 Jul 10, 2025
d9578bb
variadic tuple logic and union tests
eb8680 Jul 10, 2025
05a7849
fix union unify pattern
eb8680 Jul 10, 2025
e0cf9b3
Use unification to implement `Operation.__type_rule__` (#300)
eb8680 Jul 11, 2025
e8c1f91
Merge branch 'master' into eb-type-inference
eb8680 Jul 11, 2025
92f557a
Merge branch 'master' into eb-type-inference
eb8680 Jul 11, 2025
2345f12
update to 3.12
eb8680 Jul 11, 2025
86c5431
union
eb8680 Jul 11, 2025
3811b83
try truncating??
eb8680 Jul 11, 2025
4263617
tweaks
eb8680 Jul 11, 2025
ec61add
split up expression in _freshen
eb8680 Jul 18, 2025
f100f29
no parallel build
eb8680 Jul 18, 2025
74cf298
revert script
eb8680 Jul 18, 2025
170573c
break expressions u
eb8680 Jul 18, 2025
c5e8d36
script
eb8680 Jul 18, 2025
196806d
try again with old script??
eb8680 Jul 18, 2025
2848bb5
Merge branch 'master' into eb-type-inference
eb8680 Jul 18, 2025
c586e7b
rewrite
eb8680 Jul 23, 2025
07805bc
simplify
eb8680 Jul 23, 2025
a721108
finer error type
eb8680 Jul 24, 2025
69cd8b5
pin jax
eb8680 Jul 24, 2025
69fd5fe
Merge branch 'master' into eb-type-inference
eb8680 Jul 24, 2025
5138465
use typing internal api for substitute and freetypevars, and make can…
eb8680 Jul 24, 2025
b46231a
internal api
eb8680 Jul 24, 2025
d58f85c
revert api
eb8680 Jul 24, 2025
143e1be
add test
eb8680 Jul 24, 2025
e91d000
fix doctest
eb8680 Jul 24, 2025
63c16a0
Merge branch 'master' into eb-type-inference
eb8680 Jul 25, 2025
b9b89d4
remove unused var
eb8680 Aug 13, 2025
1b1ea3f
address some comments
eb8680 Aug 13, 2025
dcf28bc
default attr
eb8680 Aug 13, 2025
257a1be
union soundness
eb8680 Aug 13, 2025
7b5c3dc
fix union and add variadic assertion
eb8680 Aug 13, 2025
bd00749
reinstate support for bounds to make tests pass
eb8680 Aug 13, 2025
cfaa67e
nodefault
eb8680 Aug 13, 2025
55b6077
lint
eb8680 Aug 13, 2025
ad52740
forwardref
eb8680 Aug 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/source/effectful.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ Internals
.. automodule:: effectful.internals.runtime
:members:
:undoc-members:

.. automodule:: effectful.internals.unification
:members:
:undoc-members:
22 changes: 8 additions & 14 deletions docs/source/semi_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ def Let[S, T, A, B](


@defop
def Record[T](**kwargs: T) -> dict[str, T]:
def Record[T](**kwargs: T) -> collections.abc.Mapping[str, T]:
raise NotImplementedError


@defop
def Field[T](record: dict[str, T], key: str) -> T:
def Field[T](record: collections.abc.Mapping[str, T], key: str) -> T:
raise NotImplementedError


@defop
def Dict[K, V](*contents: Union[K, V]) -> SemiRingDict[K, V]:
def Dict[K, V](*contents: tuple[K, V]) -> SemiRingDict[K, V]:
raise NotImplementedError


Expand All @@ -92,20 +92,14 @@ def add[T](x: T, y: T) -> T:
ops.Field = Field


def eager_dict[K, V](*contents: Tuple[K, V]) -> SemiRingDict[K, V]:
if not any(isinstance(v, Term) for v in contents):
if len(contents) % 2 != 0:
raise ValueError("Dict requires an even number of arguments")

kv = []
for i in range(0, len(contents), 2):
kv.append((contents[i], contents[i + 1]))
return SemiRingDict(kv)
def eager_dict[K, V](*contents: tuple[K, V]) -> SemiRingDict[K, V]:
if not any(isinstance(v, Term) for kv in contents for v in kv):
return SemiRingDict(list(contents))
else:
return fwd()


def eager_record[T](**kwargs: T) -> dict[str, T]:
def eager_record[T](**kwargs: T) -> collections.abc.Mapping[str, T]:
if not any(isinstance(v, Term) for v in kwargs.values()):
return dict(**kwargs)
else:
Expand Down Expand Up @@ -215,7 +209,7 @@ def vertical_fusion[S, T](e1: T, x: Operation[[], T], e2: S) -> S:
)

term: SemiRingDict[int, int] = Let(
Sum(x(), k, v, Dict(k(), v() + 1)), y, Sum(y(), k, v, Dict(k(), v() + 1))
Sum(x(), k, v, Dict((k(), v() + 1))), y, Sum(y(), k, v, Dict((k(), v() + 1)))
)

print("Without optimization:", term)
Expand Down
Loading