37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
# servant-effectful-template
|
|
|
|
A work in progress Nix starting template for web projects utilizing
|
|
|
|
- [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)
|
|
|
|
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
|
|
- Database effect handler
|
|
- 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
|