{"id":24181,"library":"oslash","title":"OSlash","description":"A functional programming library providing Functors, Applicatives, and Monads for Python 3.12+. Current version 2.0.0, stable release with PEP 695 type parameters and strict type checking. Maintained on an irregular cadence by dbrattli.","status":"active","version":"2.0.0","language":"python","source_language":"en","source_url":"https://github.com/dbrattli/oslash","tags":["functional-programming","monads","functors","applicatives","type-hints"],"install":[{"cmd":"pip install oslash","lang":"bash","label":"Default install from PyPI"}],"dependencies":[],"imports":[{"note":"Direct import from oslash package, no submodule needed.","wrong":"","symbol":"Maybe","correct":"from oslash import Maybe"},{"note":"Import Either directly from oslash.","symbol":"Either","correct":"from oslash import Either"},{"note":"Import List (a monadic list wrapper) directly from oslash.","symbol":"List","correct":"from oslash import List"}],"quickstart":{"code":"from oslash import Maybe, Just, Nothing\n\nresult = Just(42).map(lambda x: x * 2)\nprint(result)\n# Output: Just(84)\n\nresult2 = Nothing() >> (lambda x: Just(x * 2))\nprint(result2)\n# Output: Nothing()","lang":"python","description":"Basic usage of Maybe monad with map and bind (>>)."},"warnings":[{"fix":"Upgrade to Python 3.12 or higher, or pin to an older OSlash version (<2.0.0) if you must use an older Python.","message":"Python 3.12 minimum: OSlash v2.0.0 requires Python 3.12+ and will not install on older versions.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use direct imports: `from oslash import Maybe, Either, List`.","message":"Old import paths like `from oslash.maybe import Maybe` or `from oslash.either import Either` no longer work in v2.0.0.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Always wrap plain values in the monad (e.g., `lambda x: Just(x)`) when using >>.","message":"The `List` monad's `bind` (>>) expects a function that returns a list of monadic values, not a plain list. Misuse can lead to unexpected behavior.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change import from `from oslash.maybe import Maybe` to `from oslash import Maybe`.","cause":"In OSlash v2.0.0, submodules like `oslash.maybe` were removed in favor of direct imports.","error":"ModuleNotFoundError: No module named 'oslash.maybe'"},{"fix":"Use `Nothing()` from oslash instead of plain `None`.","cause":"Used `>>` on Python's built-in None instead of OSlash's Nothing() singleton.","error":"TypeError: unsupported operand type(s) for >>: 'NoneType' and 'function'"},{"fix":"Use `from oslash import Either; value = Either.right(42)` or `Either(42, is_right=True)`.","cause":"`Right` and `Left` constructors are not exported; use `Either.right` and `Either.left` methods or the class constructors.","error":"ImportError: cannot import name 'Right' from 'oslash'"},{"fix":"Use `>>` operator, e.g., `maybe >> lambda x: Just(x+1)`.","cause":"The method for monadic bind is `>>` operator, not `.bind()`.","error":"AttributeError: 'Maybe' object has no attribute 'bind'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}