Skip to content

Commit 453120e

Browse files
committed
Merge branch 'master' into py3-stopiteration-result
Conflicts: effect/do.py
2 parents e871924 + e61b5f3 commit 453120e

22 files changed

+433
-597
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ python:
77
- "3.4"
88
- "pypy"
99
install:
10+
- pip install .
1011
- pip install -r dev-requirements.txt
11-
- pip install six
12-
- pip install 'characteristic>=14.0.0'
1312
- pip install sphinx
1413
script:
1514
- make lint

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@ doc:
1515
rm -rf docs/build
1616
rm -rf docs/source/api
1717
cd docs; sphinx-apidoc -e -o source/api ../effect ../setup.py ../examples ../effect/test_*.py
18+
rm docs/source/api/modules.rst
19+
rm docs/source/api/effect.rst
20+
# can't use sed -i on both linux and mac, so...
21+
# sed -e 's/Module contents/Core API/' docs/source/api/effect.rst > .effect.rst
22+
# mv .effect.rst docs/source/api/effect.rst
23+
# sed -e 's/effect package/API docs/' docs/source/api/effect.rst > .effect.rst
24+
# mv .effect.rst docs/source/api/effect.rst
1825
cd docs; PYTHONPATH=..:$(PYTHONPATH) sphinx-build -W -b html -d build/doctrees source build/html

README.rst

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,35 @@ Effect
44
.. image:: https://travis-ci.org/python-effect/effect.svg?branch=master
55
:target: https://travis-ci.org/python-effect/effect
66

7-
Effect is a library for helping you write purely functional code by
8-
isolating the effects (that is, IO or state manipulation) in your code.
9-
Documentation is available at https://effect.readthedocs.org/.
10-
11-
.. image:: https://radix.github.io/effect/sigh-defects.png
12-
:target: https://twitter.com/extempore2/status/553597279463305218
7+
Effect is a library for helping you write purely functional code by isolating
8+
the effects (that is, IO or state manipulation) in your code. Documentation is
9+
available at https://effect.readthedocs.org/, and its PyPI page is
10+
https://pypi.python.org/pypi/effect.
1311

12+
It `supports`_ both Python 2.6 and up, and 3.4 and up, as well as PyPy.
1413

14+
.. _`supports`: https://travis-ci.org/python-effect/effect
1515

16-
Status: Alpha
17-
=============
16+
You can install it by running ``pip install effect``.
1817

19-
Right now Effect is in alpha, and is likely to change incompatibly. Once it's
20-
being used in production and the API seems pretty good, a final version will be
21-
released. Because it's in alpha, ``pip`` requires that you explicitly specify
22-
the version number when specifying a dependency. This means that you won't
23-
automatically get upgraded to newer versions that potentially break the API.
24-
e.g., use `pip install effect==0.1aN`.
18+
.. image:: https://radix.github.io/effect/sigh-defects.png
19+
:target: https://twitter.com/extempore2/status/553597279463305218
2520

2621

2722
What Is It?
2823
===========
2924

30-
Effect lets you isolate your IO and state-manipulation code, by using a system
31-
very similar to Haskell's `extensible-effects`_ package. It also has
32-
similarities to Twisted's Deferred objects.
33-
34-
.. _`extensible-effects`: https://hackage.haskell.org/package/extensible-effects
25+
Effect lets you isolate your IO and state-manipulation code.
3526

3627
The benefits of this are many: first, the majority of your code can become
3728
purely functional, leading to easier testing and ability to reason about
3829
behavior. Also, because it separates the specification of an effect from the
3930
performance of the effect, there are two more benefits: testing becomes easier
4031
still, and it's easy to provide alternative implementations of effects.
4132

33+
Effect is somewhat similar to "algebraic effects", as implemented in various
34+
typed functional programming languages. It also has similarities to Twisted's
35+
Deferred objects.
4236

4337
Example
4438
=======
@@ -51,27 +45,27 @@ A very quick example of using Effects:
5145
from effect import perform, sync_performer, Effect, TypeDispatcher
5246
5347
class ReadLine(object):
54-
def __init__(self, prompt):
55-
self.prompt = prompt
48+
def __init__(self, prompt):
49+
self.prompt = prompt
5650
5751
def get_user_name():
58-
return Effect(ReadLine("Enter a candy> "))
52+
return Effect(ReadLine("Enter a candy> "))
5953
6054
@sync_performer
6155
def perform_read_line(dispatcher, readline):
62-
return raw_input(readline.prompt)
56+
return raw_input(readline.prompt)
6357
6458
def main():
65-
effect = get_user_name()
66-
effect = effect.on(
67-
success=lambda result: print("I like {} too!".format(result)),
68-
error=lambda e: print("sorry, there was an error. {}".format(e)))
59+
effect = get_user_name()
60+
effect = effect.on(
61+
success=lambda result: print("I like {} too!".format(result)),
62+
error=lambda e: print("sorry, there was an error. {}".format(e)))
6963
70-
dispatcher = TypeDispatcher({ReadLine: perform_read_line})
71-
perform(dispatcher, effect)
64+
dispatcher = TypeDispatcher({ReadLine: perform_read_line})
65+
perform(dispatcher, effect)
7266
7367
if __name__ == '__main__':
74-
main()
68+
main()
7569
7670
7771
``Effect`` takes what we call an ``intent``, which is any object. The

docs/source/api/effect.rst

Lines changed: 0 additions & 23 deletions
This file was deleted.

docs/source/api/modules.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/apidocs.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
API documentation
2+
=================
3+
4+
Core API
5+
--------
6+
7+
.. automodule:: effect
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
12+
13+
Submodules
14+
----------
15+
16+
.. toctree::
17+
:glob:
18+
19+
api/effect.*

0 commit comments

Comments
 (0)