https://github.com/albertllousas/monads-from-scratch
https://github.com/albertllousas/monads-from-scratch
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/albertllousas/monads-from-scratch
- Owner: albertllousas
- License: bsd-3-clause
- Created: 2022-01-21T13:30:16.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-30T05:01:00.000Z (almost 3 years ago)
- Last Synced: 2025-01-30T22:48:26.558Z (3 months ago)
- Language: Haskell
- Size: 64.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# monads-from-scratch
This repository does not pretend to be a production library, instead, it defines the most used monads in haskell from
scratch and some examples on how to use them; the idea is to understand this useful algebraic constructs.Note: Some mathematical concepts are skipped.
Please check the tests to see examples of how to use them.
Monads:
- Maybe: [Implementation](src/Monad/Maybe.hs) & [Usage](test/Monad/MaybeSpec.hs)
- Either: [Implementation](src/Monad/Either.hs) & [Usage](test/Monad/EitherSpec.hs)
- IO: [Implementation](src/Monad/IO.hs) & [Usage](test/Monad/IOSpec.hs)
- List: [Implementation](src/Monad/List.hs) & [Usage](test/Monad/ListSpec.hs)
- Reader: [Implementation](src/Monad/Reader.hs) & [Usage](test/Monad/ReaderSpec.hs)
- Writer: [Implementation](src/Monad/Writer.hs) & [Usage](test/Monad/WriterSpec.hs)
- State: [Implementation](src/Monad/State.hs) & [Usage](test/Monad/StateSpec.hs)Monad transformers:
- ReaderT: [Implementation](src/Monad/Transformer/ReaderT.hs) & [Usage](test/Monad/Transformer/ReaderTSpec.hs)
- StateT: [Implementation](src/Monad/Transformer/StateT.hs) & [Usage](test/Monad/Transformer/StateTSpec.hs)
- EitherT: [Implementation](src/Monad/Transformer/EitherT.hs) & [Usage](test/Monad/Transformer/EitherTSpec.hs)
- MaybeT: [Implementation](src/Monad/Transformer/MaybeT.hs) & [Usage](test/Monad/Transformer/MaybeTSpec.hs)
- WriterT: [Implementation](src/Monad/Transformer/WriterT.hs) & [Usage](test/Monad/Transformer/WriterTSpec.hs)Type classes:
- Functor: [Implementation](src/Functor.hs)
- Applicative Functor: [Implementation](src/ApplicativeFunctor.hs)
- Monad: [Implementation](src/Monad.hs)
- Monad Transformer: [Implementation](src/MonadTransformer.hs)## Build
```shell
stack build
```## Run tests
```shell
stack test
```