2024-09-18 13:16:36 -05:00
# servant-effectful-template
2024-10-13 10:40:51 -05:00
A work in progress Nix starting template for web projects utilizing
2024-09-18 13:16:36 -05:00
- [Haskell ](https://wiki.haskell.org/Haskell )
- [Effectful ](https://github.com/haskell-effectful/effectful )
- [Lucid ](https://github.com/chrisdone/lucid )
- [PostgreSQL ](https://www.postgresql.org/ )
- [Servant ](https://github.com/haskell-servant/servant )
2024-10-12 17:38:22 -05:00
2024-10-21 17:59:50 -05:00
The repository has a simple CRUD implementation of a "Users" API which demonstrates how to use included effects, create your own effects, write/compose HTML using Lucid, and bubble errors to Servant's `ServerError` type.
How to navigate this codebase (as of revision 77131c4a):
- Core
- Application data types
- Effect definitions
- Utility function for lifting IO to effectful's IOE
- Database
2024-11-05 15:18:21 -06:00
- Database effect handler
2024-10-21 17:59:50 -05:00
- Table definitons as functions
- Helper functions for constructing SQL queries
- Handlers
- Request handlers in the Eff monad
- Logger
- Logging implementation using the Database effect for logging to PSQL
- Logging implementation to stdout
- Main
- Application entry point and initialization
- Creates a PostgreSQL connection pool to include in the Reader effect
- Effect stack runner for real database interactions
- Debugging effect stack that mocks database interactions and logs to stdout instead
- Routes
- Type level route definitions for Servant
- Views
- Lucid2 HTML templating and composition functions