Skip to content

Consider adding IO monad #79

@sobolevn

Description

@sobolevn

It might be a good idea to promote https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell idea in IO[] type.

Let's see an example:

from returns.io import IO, impure

@impure
def get_username() -> str:
     return input('Hi, what is your name?')

reveal_type(get_username())  # => IO[str]
get_username().split('@')  # nope! type error!
get_username().map(lambda name: name.split('@'))  # => IO[List[str]]

It is important to restrict any access to the internal state of this object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions