Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apfohl/go-monadic
A functional programming library for Go
https://github.com/apfohl/go-monadic
functional-programming go monads
Last synced: 27 days ago
JSON representation
A functional programming library for Go
- Host: GitHub
- URL: https://github.com/apfohl/go-monadic
- Owner: apfohl
- License: mit
- Created: 2023-06-22T21:00:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-19T19:21:25.000Z (11 months ago)
- Last Synced: 2024-10-10T03:34:14.168Z (about 1 month ago)
- Topics: functional-programming, go, monads
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go monadic
"Go monadic" is a functional programming library for Go. It's purpose is to provide
basic monad implementations to support functional programming approaches in Go.## Monads
- Maybe
## API
This section describes the API of the library and how to use it.
### Maybe
The `Maybe` monad encapsulates a value and provides functions to `Map` the value and
to compose it with other functions returning a value of the `Maybe` type through `Bind`.
`Maybe` can be in two states: `Just` and `Nothing`. In the `Just` state it's containing
an actual value. In the `Nothing` state it's empty.To create a value of `Maybe` there are two ways:
- `functional.Just[int, int](42)`: This creates a `Maybe` containing a value
- `functional.Nothing[int, int]`: This creates an empty `Maybe`