Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel YU committed Jul 30, 2019
1 parent 42ab525 commit bdbb74e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# boots

[![Hackage](https://img.shields.io/hackage/v/boots.svg)](https://hackage.haskell.org/package/boots)
[![Hackage](https://img.shields.io/hackage/v/boots.svg?logo=haskell)](https://hackage.haskell.org/package/boots)
[![Build](https://img.shields.io/travis/leptonyu/boots.svg?logo=travis)](https://travis-ci.org/leptonyu/boots)
[![stackage LTS package](http://stackage.org/package/boots/badge/lts)](http://stackage.org/lts/package/boots)
[![stackage Nightly package](http://stackage.org/package/boots/badge/nightly)](http://stackage.org/nightly/package/boots)
[![Build Status](https://travis-ci.org/leptonyu/boots.svg?branch=master)](https://travis-ci.org/leptonyu/boots)
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/leptonyu/boots/blob/master/LICENSE)

Boot applications by using plugins.

Expand All @@ -13,8 +14,13 @@ Simplify to create an application in Haskell.

When we decide to create an application using Haskell. We may need using configurations, loggers as basic functions. If this application needs storages, caches, etc., then we have to weaving the management of connection of these facilities into the application. Connections need to be created before and be destroyed after using them. There is a common strategy to manage connections, that is using `Control.Monad.Cont`. Then we can encapsulate the management of connections separately. For example, we can write a database plugin `Plugin cxt m DBConnection`, which can manage the database connections in monad `m` with context `cxt`. Context `cxt` may be requested for configurations or logging functions. When all the components of application are encapsulated by plugins, then building an application will be simplified.

## A Project Use boots to Build

Refer to [鬼谷子](https://github.com/leptonyu/guiguzi)

### Have a Try


```Haskell
main :: IO ()
main = bootApp (pluginSimple "application") go
Expand Down
2 changes: 1 addition & 1 deletion src/Boots/Internal/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ promote i pimu = Plugin $ lift $ ContT (runPlugin i pimu)

-- | Combines plugins into one.
combine :: [Plugin i m i] -> Plugin i m i
combine fs = foldl (\b a -> b >>= \i -> promote i a) ask fs
combine = foldl (\b a -> b >>= \i -> promote i a) ask

-- | Convert a plugin into another.
withPlugin :: (i -> j) -> Plugin j m u -> Plugin i m u
Expand Down

0 comments on commit bdbb74e

Please sign in to comment.