Skip to content

Commit

Permalink
Working on docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Jan 29, 2020
1 parent f50121b commit f295d2d
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions docs/pages/context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,46 @@ Which means that it is a wrapper around pure function that might fail.
We also added a lot of useful methods for this container,
so you can work easily with it:

- :meth:`returns.context.requires_context.RequiresContextResult.from_typecast`
.. currentmodule:: returns.context.requires_context_result

- :meth:`~RequiresContextResult.from_typecast`
turns accidental ``RequiresContext[env, Result[a, b]]`` into
full-featured ``RequiresContextResult[env, a, b]``
- :meth:`returns.context.requires_context.RequiresContextResult.bind_result`
- :meth:`~RequiresContextResult.bind_result`
allows to bind functions that return ``Result`` with just one call
- :meth:returns.context.requires_context.RequiresContextResult.bind_context`
- :meth:`~RequiresContextResult.bind_context`
allows to bind functions that return ``RequiresContext`` easily
- There are also several useful contructors from any possible type

Use it when you work with pure context-related functions that might fail.


RequiresContextIOResult container
---------------------------------

This container is a combintaion of ``RequiresContext[env, IOResult[a, b]]``.
Which means that it is a wrapper around impure function that might fail.

We also added a lot of useful methods for this container,
so you can work easily with it:

.. currentmodule:: returns.context.requires_context_io_result

- :meth:`~RequiresContextIOResult.from_typecast`
turns accidental ``RequiresContext[env, IOResult[a, b]]`` into
full-featured ``RequiresContextIOResult[env, a, b]``
- :meth:`~RequiresContextIOResult.bind_result`
allows to bind functions that return ``Result`` with just one call
- :meth:`~RequiresContextIOResult.bind_ioresult`
allows to bind functions that return ``IOResult`` with just one call
- :meth:`~RequiresContextIOResult.bind_context`
allows to bind functions that return ``RequiresContext`` easily
- There are also several useful contructors from any possible type

Use it when you work with impure context-related functions that might fail.
This is basically **the main type** that is going to be used in most apps.


FAQ
---

Expand Down Expand Up @@ -384,7 +412,7 @@ RequiresContextResult
:members:

RequiresContextIOResult
~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~

.. autoclasstree:: returns.context.requires_context_io_result

Expand Down

0 comments on commit f295d2d

Please sign in to comment.