ngx-export-tools 1.1.0 → 1.2.0
raw patch · 4 files changed
+80/−6 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ NgxExport.Tools.Combinators: voidHandler :: IO a -> IO ByteString
Files
- Changelog.md +5/−0
- NgxExport/Tools.hs +5/−5
- NgxExport/Tools/Combinators.hs +68/−0
- ngx-export-tools.cabal +2/−1
Changelog.md view
@@ -1,3 +1,8 @@+### 1.2.0++- Added a new module *NgxExport.Tools.Combinators* which exports a new function+ *voidHandler* and the whole module *NgxExport.Tools.SplitService*.+ ### 1.1.0 - Use polymorphic return types in functions *terminateWorkerProcess*,
NgxExport/Tools.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : NgxExport.Tools--- Copyright : (c) Alexey Radkov 2018-2022+-- Copyright : (c) Alexey Radkov 2018-2023 -- License : BSD-style -- -- Maintainer : alexey.radkov@gmail.com@@ -15,21 +15,21 @@ module NgxExport.Tools (+ -- | === Combinators of effectful actions (including split services)+ module NgxExport.Tools.Combinators -- | === Reading custom types from /ByteStrings/- module NgxExport.Tools.Read+ ,module NgxExport.Tools.Read -- | === Exporters of simple services ,module NgxExport.Tools.SimpleService- -- | === Split services- ,module NgxExport.Tools.SplitService -- | === Various functions to access low-level Nginx API ,module NgxExport.Tools.System -- | === A simple implementation of time intervals ,module NgxExport.Tools.TimeInterval ) where +import NgxExport.Tools.Combinators import NgxExport.Tools.Read import NgxExport.Tools.SimpleService-import NgxExport.Tools.SplitService import NgxExport.Tools.System import NgxExport.Tools.TimeInterval
+ NgxExport/Tools/Combinators.hs view
@@ -0,0 +1,68 @@+-----------------------------------------------------------------------------+-- |+-- Module : NgxExport.Tools.Combinators+-- Copyright : (c) Alexey Radkov 2023+-- License : BSD-style+--+-- Maintainer : alexey.radkov@gmail.com+-- Stability : stable+-- Portability : portable+--+-----------------------------------------------------------------------------+++module NgxExport.Tools.Combinators (+ -- * Combinators of effectful actions+ -- $description++ -- * Void handler+ voidHandler+ -- * Split services+ ,module NgxExport.Tools.SplitService+ ) where++import NgxExport.Tools.SplitService++import qualified Data.ByteString.Lazy as L++-- $description+--+-- A set of convenient combinators of effectful actions for building handlers+-- and services tuned for special purposes.++-- | Runs an effectful computation and then returns an empty 'L.ByteString'+--+-- This combinator saves printing the final @return L.empty@ action in handlers+-- that return unused or empty 'L.ByteString'.+--+-- For example, handler /signalUpconf/ being declared as an+-- [/update callback/](https://github.com/lyokha/nginx-haskell-module#update-callbacks)+-- in+--+-- @+-- type Upconf = [Text]+--+-- signalUpconf :: Upconf -> Bool -> IO L.ByteString+-- signalUpconf upconf = const $ do+-- mapConcurrently_ getUrl upconf+-- return L.empty+--+-- 'NgxExport.Tools.SimpleService.ngxExportSimpleServiceTyped' \'signalUpconf \'\'Upconf $+-- 'NgxExport.Tools.SimpleService.PersistentService' Nothing+-- @+--+-- returns an empty bytestring which is not used in a meaningful way, therefore+-- it can be rewritten as+--+-- @+-- signalUpconf :: Upconf -> Bool -> IO L.ByteString+-- signalUpconf = const . __/voidHandler/__ . mapConcurrently_ getUrl+-- @+--+-- which helps to focus better on the computation itself.+--+-- @since 1.2.0+voidHandler :: IO a -- ^ Target computation+ -> IO L.ByteString+voidHandler = (>> return L.empty)+
ngx-export-tools.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-tools-version: 1.1.0+version: 1.2.0 synopsis: Extra tools for Nginx haskell module description: Extra tools for <https://github.com/lyokha/nginx-haskell-module Nginx haskell module>.@@ -26,6 +26,7 @@ , safe exposed-modules: NgxExport.Tools+ NgxExport.Tools.Combinators NgxExport.Tools.Read NgxExport.Tools.SimpleService NgxExport.Tools.SplitService