Skip to content

Commit 8421039

Browse files
committed
Untyped module
1 parent f9eee44 commit 8421039

File tree

20 files changed

+396
-300
lines changed

20 files changed

+396
-300
lines changed

Makefile

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
1-
.PHONY: test-opt test-src clean format check publish docs opt
1+
.PHONY: test clean format check publish docs opt
22

3-
test-opt: opt
4-
cd opt/ && python -m pytest
5-
6-
test-src:
7-
cd src/ && python -m pytest
3+
test: opt
4+
python -m pytest
85

96
clean:
107
./clean.sh
118

129
format:
1310
black `find . -iname "*.py" -type f`
1411

15-
check: format test-src clean test-opt docs
12+
check: format test docs
1613

17-
publish: check
18-
./clean.sh
19-
./opt.sh
20-
cd opt/ && python setup.py sdist
21-
cd opt/ && twine upload dist/*
14+
publish: check clean
15+
python setup.py sdist
16+
twine upload dist/*
2217

2318
docs:
2419
rm -r docs/ || true
25-
cd src/ && pdoc3 --html raffiot -o ../docs/
20+
pdoc3 --html raffiot -o docs/
2621
mv docs/raffiot/* docs/
2722
rm -r docs/raffiot/
2823
git add docs/
2924

30-
opt: clean
25+
opt:
3126
./opt.sh
32-
33-
profile: opt
34-
cd opt && python -m cProfile ../benchmarks/imeprofile.py 30 | less

benchmarks/fibonacci.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ def fibo(i: int) -> int:
1717

1818
def fibo_io(i: int) -> IO:
1919
if i > 1:
20-
return io.defer_io(lambda: fibo_io(i-1)).flat_map(lambda x: fibo_io(i-2).map(lambda y: x+y))
20+
return io.defer_io(lambda: fibo_io(i - 1)).flat_map(
21+
lambda x: fibo_io(i - 2).map(lambda y: x + y)
22+
)
2123
else:
2224
return io.pure(i)
2325

@@ -46,6 +48,7 @@ def mesure_io(nb):
4648
i += 1
4749
return statistics.median(l)
4850

51+
4952
x = 8
5053

5154
print(f"fibo({x})=${fibo(x)}")

benchmarks/imeprofile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
def fibo_io(i: int) -> IO:
88
if i > 1:
9-
return io.defer_io(lambda: fibo_io(i - 1)).flat_map(lambda x: fibo_io(i-2).map(lambda y: x + y))
9+
return io.defer_io(lambda: fibo_io(i - 1)).flat_map(
10+
lambda x: fibo_io(i - 2).map(lambda y: x + y)
11+
)
1012
else:
1113
return io.pure(i)
1214

clean.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
2-
rm -r opt || true
3-
rm -r `find . -type d -and \( -iname ".hypothesis" -or -iname ".pytest_cache" -or -iname "dist" -or -iname "raffiot.egg-info" -or -iname "__pycache__" \)` || true
2+
rm -r `find . -type d -and \( -iname ".hypothesis" -or -iname ".pytest_cache" -or -iname "dist" -or -iname "raffiot.egg-info" -or -iname "__pycache__" -or -iname "untyped" \)` || true
3+
rm -r tests/test_untyped_*.py || true

docs/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ <h2 class="section-title" id="header-submodules">Sub-modules</h2>
5454
<dd>
5555
<div class="desc"><p>Data structure to represent the result of computation.</p></div>
5656
</dd>
57+
<dt><code class="name"><a title="raffiot.untyped" href="untyped/index.html">raffiot.untyped</a></code></dt>
58+
<dd>
59+
<div class="desc"></div>
60+
</dd>
5761
</dl>
5862
</section>
5963
<section>
@@ -74,6 +78,7 @@ <h1>Index</h1>
7478
<li><code><a title="raffiot.io" href="io.html">raffiot.io</a></code></li>
7579
<li><code><a title="raffiot.resource" href="resource.html">raffiot.resource</a></code></li>
7680
<li><code><a title="raffiot.result" href="result.html">raffiot.result</a></code></li>
81+
<li><code><a title="raffiot.untyped" href="untyped/index.html">raffiot.untyped</a></code></li>
7782
</ul>
7883
</li>
7984
</ul>

0 commit comments

Comments
 (0)