Add more detail to readme

This commit is contained in:
Joscha 2020-04-09 21:15:35 +00:00
parent 46dc9242cf
commit a1cae8be03
5 changed files with 36 additions and 6 deletions

View file

@ -10,6 +10,7 @@
- clean up project - clean up project
- fix nick of example bot in readme - fix nick of example bot in readme
- remove `Haboli.Euphoria.Examples` module - remove `Haboli.Euphoria.Examples` module
- update `README.md` to reflect these changes
## 0.3.1.0 ## 0.3.1.0
- add `Haboli.Euphoria` module - add `Haboli.Euphoria` module

View file

@ -21,9 +21,25 @@ supports all session and chat room commands listed in the
For more information, see the haddock for the `Haboli.Euphoria.Client` and For more information, see the haddock for the `Haboli.Euphoria.Client` and
`Haboli.Euphoria.Api` modules. `Haboli.Euphoria.Api` modules.
## Example bot ## Bots
Here is a very basic example bot that replies to `!ping` with `Pong!`: The library is built with flexibility and composability in mind. Because of
this, there is no special `Bot` monad — bots also run inside the `Client` monad.
However, there are a few convenience modules that make development of bots
easier.
The convenience modules are built on top of the `Client` monad. None of the
convenience modules are necessary to create a functioning bot. When creating a
new bot, you can freely choose which modules to use and which to ignore or
replace with your own creations.
For an example bot structure using the convenience modules, here is an
[example bot](src/Haboli/Euphoria/ExampleBot.hs).
## Example client
Here is a very basic example bot that replies to `!ping` with `Pong!`. It does
not use any of the provided convenience modules.
```haskell ```haskell
pingPongBot :: Client () () pingPongBot :: Client () ()
@ -44,3 +60,11 @@ And here's how to run that bot:
main :: IO () main :: IO ()
main = void $ runClient defaultConfig pingPongBot main = void $ runClient defaultConfig pingPongBot
``` ```
## Lenses
Haboli exports lenses for a few data types. The lenses are named like the record
accessors but suffixed with a `L`. For example, the lens corresponding to
`svNick` from `SessionView` is named `svNickL`. Lenses are not required to use
the libary. They are provided for the convenience of those who like using
lenses.

View file

@ -1,10 +1,10 @@
cabal-version: 1.12 cabal-version: 1.18
-- This file has been generated from package.yaml by hpack version 0.31.2. -- This file has been generated from package.yaml by hpack version 0.31.2.
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: 35dc75bb1fd8534c4476115b165d0e969a579affaa05a419abe6f7e3ab749082 -- hash: 3ce7165a468ff6ccd5e098638b16268df6af5b8dbd4f0ac2e5490a29f6f15a37
name: haboli name: haboli
version: 0.3.1.0 version: 0.3.1.0
@ -22,6 +22,8 @@ extra-source-files:
README.md README.md
CHANGELOG.md CHANGELOG.md
LICENSE LICENSE
extra-doc-files:
README.md
source-repository head source-repository head
type: git type: git

View file

@ -13,6 +13,9 @@ extra-source-files:
- CHANGELOG.md - CHANGELOG.md
- LICENSE - LICENSE
extra-doc-files:
- README.md
dependencies: dependencies:
- base >= 4.7 && < 5 - base >= 4.7 && < 5
- aeson - aeson

View file

@ -1,6 +1,6 @@
-- | This module reexports the most commonly used modules for convenience. For -- | This module reexports the most commonly used modules for convenience. For
-- more detail on how this library works, check the "Haboli.Euphoria.Client" -- more detail on how this library works, check the <README.md> or the
-- module's documentation. -- "Haboli.Euphoria.Client" module's documentation.
module Haboli.Euphoria module Haboli.Euphoria
( module Haboli.Euphoria.Api ( module Haboli.Euphoria.Api